Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
esaulpaugh committed Jan 9, 2021
1 parent d665cb7 commit 8767447
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/test/java/com/esaulpaugh/headlong/abi/EncodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import java.util.function.Supplier;

import static com.esaulpaugh.headlong.TestUtils.assertThrown;
import static com.esaulpaugh.headlong.TestUtils.shutdownAwait;
import static com.esaulpaugh.headlong.TestUtils.requireNoTimeout;
import static com.esaulpaugh.headlong.TestUtils.shutdownAwait;
import static com.esaulpaugh.headlong.abi.TypeFactory.EMPTY_PARAMETER;
import static com.esaulpaugh.headlong.abi.UnitType.UNIT_LENGTH_BYTES;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
Expand Down Expand Up @@ -461,7 +461,7 @@ public void testScaleErr() throws Throwable {
}

@Test
public void testNesterErrMessage() throws Throwable {
public void testNestedErrMessage() throws Throwable {
assertThrown(
IllegalArgumentException.class,
"tuple index 0: array index 1: signed val exceeds bit limit: 9 >= 8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import java.math.BigInteger;
import java.util.Random;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class FloatingPointTest {

@Test
Expand All @@ -33,11 +36,12 @@ public void testFloat() {
final float flo = r.nextFloat();
byte[] floBytes = FloatingPoint.toBytes(flo);
byte[] floPutted = new byte[floBytes.length];
FloatingPoint.putFloat(flo, floPutted, 0);
Assertions.assertArrayEquals(floBytes, floPutted);
int len = FloatingPoint.putFloat(flo, floPutted, 0);
assertEquals(floBytes.length, len);
assertArrayEquals(floBytes, floPutted);

float floGotten = FloatingPoint.getFloat(floBytes, 0, floBytes.length, false);
Assertions.assertEquals(flo, floGotten);
assertEquals(flo, floGotten);
}
}

Expand All @@ -48,11 +52,12 @@ public void testDouble() {
final double dub = r.nextDouble();
byte[] dubBytes = FloatingPoint.toBytes(dub);
byte[] dubPutted = new byte[dubBytes.length];
FloatingPoint.putDouble(dub, dubPutted, 0);
Assertions.assertArrayEquals(dubBytes, dubPutted);
int len = FloatingPoint.putDouble(dub, dubPutted, 0);
assertEquals(dubBytes.length, len);
assertArrayEquals(dubBytes, dubPutted);

double dubGotten = FloatingPoint.getDouble(dubBytes, 0, dubBytes.length, false);
Assertions.assertEquals(dub, dubGotten);
assertEquals(dub, dubGotten);
}
}

Expand All @@ -65,7 +70,7 @@ public void testBigDecimal() {
byte[] bytes = Integers.toBytesUnsigned(bigDec.unscaledValue());

BigDecimal gotten = FloatingPoint.getBigDecimal(bytes, 0, bytes.length, bigDec.scale(), false);
Assertions.assertEquals(bigDec, gotten);
assertEquals(bigDec, gotten);
}
}
}

0 comments on commit 8767447

Please sign in to comment.