mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Improve error message if there is not an expected number
This commit is contained in:
parent
833cd8c80a
commit
b81ea073a9
@ -375,14 +375,25 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
expected = new Integer( ((Boolean)expected) ? 1 : 0 );
|
expected = new Integer( ((Boolean)expected) ? 1 : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
String actual = evalWasm( script, methodName, params );
|
Object actual;
|
||||||
|
String actualStr = evalWasm( script, methodName, params );
|
||||||
if( expected instanceof Double ) { // handle different string formating of double values
|
if( expected instanceof Double ) { // handle different string formating of double values
|
||||||
assertEquals( actual, expected, Double.valueOf( actual ) );
|
try {
|
||||||
|
actual = Double.valueOf( actualStr );
|
||||||
|
} catch( NumberFormatException ex ) {
|
||||||
|
actual = actualStr;
|
||||||
|
}
|
||||||
} else if( expected instanceof Float ) { // handle different string formating of float values
|
} else if( expected instanceof Float ) { // handle different string formating of float values
|
||||||
assertEquals( actual, expected, Float.valueOf( actual ) );
|
try {
|
||||||
|
actual = Float.valueOf( actualStr );
|
||||||
|
} catch( NumberFormatException ex ) {
|
||||||
|
actual = actualStr;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assertEquals( String.valueOf( expected ), actual );
|
expected = String.valueOf( expected );
|
||||||
|
actual = actualStr;
|
||||||
}
|
}
|
||||||
|
assertEquals( expected, actual );
|
||||||
} catch( Throwable ex ) {
|
} catch( Throwable ex ) {
|
||||||
failed = true;
|
failed = true;
|
||||||
throwException( ex );
|
throwException( ex );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user