Skip to content

Commit

Permalink
add: unittest.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertWeichselbraun committed Oct 30, 2018
1 parent 9daf844 commit ba31956
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/com/weblyzard/lib/string/nilsimsa/NilsimsaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,23 @@ public void equalsSpecialCasesTest() {
assertEquals(h, h);
assertEquals(h, Nilsimsa.getHash("test"));
}

/**
* Tests the example from the README.md file.
*/
@Test
public void readmeSimilarityTest() {
Nilsimsa first = Nilsimsa.getHash("A short test message");
Nilsimsa second = Nilsimsa.getHash("A short test message!");
Nilsimsa third = Nilsimsa.getHash("Something completely different");


assertEquals(0, first.bitwiseDifference(first));
assertEquals(3, first.bitwiseDifference(second));
assertEquals(133, first.bitwiseDifference(third));
}


/**
* compile test mapping
*
Expand Down

0 comments on commit ba31956

Please sign in to comment.