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
or Kartik K. Agaram <vc@akkartik.com> 2016-12-26 22:09:54 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-12-26 22:09:54 -0800 3716' href='/akkartik/mu/commit/html/counters.mu.html?h=hlt&id=4c4d325ca8544f52bb305dbb46b1f8144c33c2af'>4c4d325c ^
a654e4ec ^
805d58c6 ^
fe8bf967 ^
805d58c6 ^

4bb57a55 ^

c5ffb6e1 ^

a654e4ec ^



e5c11a51 ^






















a654e4ec ^

c5ffb6e1 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^


b301e0c0 ^
204dae92 ^
4a48bedc ^
204dae92 ^

b301e0c0 ^
204dae92 ^
4a48bedc ^
b301e0c0 ^
204dae92 ^


b301e0c0 ^
204dae92 ^

b301e0c0 ^
204dae92 ^
b301e0c0 ^
204dae92 ^
b301e0c0 ^


204dae92 ^

50685c29 ^
204dae92 ^
c5ffb6e1 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90