diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_modulo_in_when.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_modulo_in_when.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_modulo_in_when.txt b/js/scripting-lang/scratch_tests/test_modulo_in_when.txt new file mode 100644 index 0000000..4b2b023 --- /dev/null +++ b/js/scripting-lang/scratch_tests/test_modulo_in_when.txt @@ -0,0 +1,30 @@ +/* Test modulo operator in when expressions */ + +/* Test basic modulo */ +test1 : 15 % 3; +..out test1; + +/* Test modulo in when expression */ +test2 : when 15 % 3 is + 0 then "divisible by 3" + _ then "not divisible by 3"; + +..out test2; + +/* Test multiple values in when expression */ +test3 : when 15 % 3 15 % 5 is + 0 0 then "divisible by both" + 0 _ then "divisible by 3 only" + _ 0 then "divisible by 5 only" + _ _ then "divisible by neither"; + +..out test3; + +/* Test modulo with equals function in when expression */ +test4 : when equals (15 % 3) 0 equals (15 % 5) 0 is + true true then "divisible by both" + true false then "divisible by 3 only" + false true then "divisible by 5 only" + false false then "divisible by neither"; + +..out test4; \ No newline at end of file |