about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt')
-rw-r--r--js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt b/js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt
new file mode 100644
index 0000000..0b6cf39
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/test_simple_fizzbuzz.txt
@@ -0,0 +1,43 @@
+/* Simple FizzBuzz test */
+
+/* Test basic modulo */
+test1 : 15 % 3;
+test2 : 15 % 5;
+..out test1;
+..out test2;
+
+/* Test basic when with modulo */
+test3 : when 15 % 3 is
+  0 then "divisible by 3"
+  _ then "not divisible by 3";
+..out test3;
+
+/* Test simple function */
+simple_test : n -> n;
+
+result1 : simple_test 3;
+..out result1;
+
+/* Test when inside function */
+when_test : n ->
+  when n is
+    3 then "three"
+    _ then n;
+
+result2 : when_test 3;
+..out result2;
+
+/* Test modulo in function */
+modulo_test : n -> n % 3;
+
+result3 : modulo_test 15;
+..out result3;
+
+/* Test greater than in when */
+greater_test : n ->
+  when n > 0 is
+    true then "positive"
+    _ then "non-positive";
+
+result4 : greater_test 5;
+..out result4; 
\ No newline at end of file