mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
add tests for compare of non int data values
This commit is contained in:
parent
0df046a644
commit
ec10240c52
@ -43,6 +43,7 @@ public class ControlFlowOperators extends AbstractBaseTest {
|
||||
addParam( list, script, "ifne" );
|
||||
addParam( list, script, "iflt" );
|
||||
addParam( list, script, "ifMultiple" );
|
||||
addParam( list, script, "ifMultipleDouble" );
|
||||
addParam( list, script, "ifCompare" );
|
||||
addParam( list, script, "switchDirect" );
|
||||
addParam( list, script, "endlessLoop" );
|
||||
@ -129,6 +130,54 @@ public class ControlFlowOperators extends AbstractBaseTest {
|
||||
return condition;
|
||||
}
|
||||
|
||||
@Export
|
||||
static int ifMultipleDouble() {
|
||||
double condition = 3;
|
||||
if( condition <= 0 ) {
|
||||
if( condition < 0 ) {
|
||||
condition = 13;
|
||||
}
|
||||
} else {
|
||||
if( condition > 0 ) {
|
||||
condition++;
|
||||
} else {
|
||||
condition--;
|
||||
}
|
||||
}
|
||||
if( condition > 2 ) {
|
||||
condition *= 2;
|
||||
} else {
|
||||
condition = 0;
|
||||
}
|
||||
if( condition >= 2 ) {
|
||||
condition *= 2;
|
||||
} else {
|
||||
condition = 0;
|
||||
}
|
||||
if( condition <= 123 ) {
|
||||
condition *= 2;
|
||||
} else {
|
||||
condition = 0;
|
||||
}
|
||||
if( condition < 123 ) {
|
||||
condition *= 2;
|
||||
} else {
|
||||
condition = 0;
|
||||
}
|
||||
if( condition != 123 ) {
|
||||
condition *= 2;
|
||||
} else {
|
||||
condition = 0;
|
||||
}
|
||||
if( condition == 123 ) {
|
||||
condition = 0;
|
||||
} else {
|
||||
condition *= 2;
|
||||
}
|
||||
int x = (int)(25 / condition); // prevent 0 as value
|
||||
return (int)condition;
|
||||
}
|
||||
|
||||
@Export
|
||||
static int ifCompare() {
|
||||
double condition = 3.0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user