Skip to content

Commit

Permalink
Remove use of StandardCharsets in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leventov committed Sep 9, 2015
1 parent 5d06f82 commit 4a0d724
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/test/java/net/openhft/hashing/OriginalFarmHashTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.junit.Assert;
import org.junit.Test;

import java.nio.charset.StandardCharsets;
import java.io.UnsupportedEncodingException;

import static net.openhft.hashing.CityAndFarmHash_1_1.K0;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -134,6 +134,19 @@ static int testUo(int offset, int len, int expectedIndex) {
}


@Test
public void testUoGo() {
for (Object[] g : GOLDEN_64) {
long hash = (Long) g[0];
try {
byte[] s = ((String)g[1]).getBytes("US-ASCII");
Assert.assertEquals(hash, LongHashFunction.farmUo().hashBytes(s));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
}

static final Object[][] GOLDEN_64 = {
{0xb3454265b6df75e3L, "a"},
{0xaa8d6e5242ada51eL, "ab"},
Expand Down Expand Up @@ -167,15 +180,6 @@ static int testUo(int offset, int len, int expectedIndex) {
{0x5a0a6efd52e84e2aL, "How can you write a big system without C++? -Paul Glick"},
};

@Test
public void testUoGo() {
for (Object[] g : GOLDEN_64) {
long hash = (Long) g[0];
byte[] s = ((String)g[1]).getBytes(StandardCharsets.US_ASCII);
Assert.assertEquals(hash, LongHashFunction.farmUo().hashBytes(s));
}
}

static final long[] NA_EXPECTED = {
1140953930L, 861465670L,
3277735313L, 2681724312L,
Expand Down

0 comments on commit 4a0d724

Please sign in to comment.