Skip to content

Commit

Permalink
Update wasm/src/test/java/com/dylibso/chicory/wasm/types/ValueTest.java
Browse files Browse the repository at this point in the history
Co-authored-by: David Phillips <david@acz.org>
  • Loading branch information
andreaTP and electrum committed Oct 14, 2024
1 parent d1fac3c commit 3522b98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ public boolean isReference() {
}
}

public boolean isVec() {
switch (this) {
case V128:
return true;
default:
return false;
}
}

/**
* @return {@code true} if the given type ID is a valid value type ID, or {@code false} if it is not
*/
Expand Down
16 changes: 8 additions & 8 deletions wasm/src/test/java/com/dylibso/chicory/wasm/types/ValueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void toStringContract() {

@Test
public void shouldConvertToArrays() {
long x = 506097522914230528L;
long x = 0x0706_0504_0302_0100L;
var result = Value.vecTo8(new long[] {x});

assertEquals(8, result.length);
Expand All @@ -90,9 +90,9 @@ public void shouldConvertToArrays() {

@Test
public void shouldConvertToArraysHL() {
long xLow = 0x0706_0504_0302_0100L;
long xHigh = 0x0F0E_0D0C_0B0A_0908L;
var result = Value.vecTo8(new long[] {xLow, xHigh});
long xLo = 0x0706_0504_0302_0100L;
long xHi = 0x0F0E_0D0C_0B0A_0908L;
var result = Value.vecTo8(new long[] {xLo, xHi});

assertEquals(16, result.length);
assertEquals(0, result[0]);
Expand All @@ -117,11 +117,11 @@ public void shouldConvertToArraysHL() {
public void shouldConvertBackFromBytes() {
var value = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
var result = Value.bytesToVec(value);
long xLow = 0x0706_0504_0302_0100L;
long xHigh = 0x0F0E_0D0C_0B0A_0908L;
long xLo = 0x0706_0504_0302_0100L;
long xHi = 0x0F0E_0D0C_0B0A_0908L;

assertEquals(2, result.length);
assertEquals(xLow, result[0]);
assertEquals(xHigh, result[1]);
assertEquals(xLo, result[0]);
assertEquals(xHi, result[1]);
}
}

0 comments on commit 3522b98

Please sign in to comment.