gloo 6.4.0 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/application.md +9 -0
- data/docs/language_objects.md +40 -0
- data/docs/objects.md +1 -1
- data/docs/verbs.md +9 -0
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +11 -0
- data/lib/gloo/app/engine.rb +5 -1
- data/lib/gloo/app/log.rb +5 -5
- data/lib/gloo/app/settings.rb +4 -1
- data/lib/gloo/core/obj.rb +21 -1
- data/lib/gloo/persist/file_loader.rb +7 -0
- data/lib/gloo/persist/persist_man.rb +35 -3
- data/lib/gloo/persist/source/obj_node.rb +41 -0
- data/lib/gloo/verbs/list.rb +24 -2
- data/lib/gloo/verbs/load.rb +13 -2
- data/test.gloo/ctrl/each.test.gloo +28 -30
- data/test.gloo/dt/date.test.gloo +69 -71
- data/test.gloo/dt/datetime.test.gloo +55 -57
- data/test.gloo/dt/time.test.gloo +70 -72
- data/test.gloo/lang/continuation.test.gloo +25 -27
- data/test.gloo/lang/convert.test.gloo +50 -52
- data/test.gloo/lang/dt_comparisons.test.gloo +87 -89
- data/test.gloo/lang/exceptions.test.gloo +42 -44
- data/test.gloo/lang/gloo_sys.test.gloo +100 -102
- data/test.gloo/lang/here.test.gloo +32 -34
- data/test.gloo/lang/it.test.gloo +27 -29
- data/test.gloo/lang/literal.test.gloo +55 -57
- data/test.gloo/lang/load_lib_directive.test.gloo +18 -20
- data/test.gloo/lang/naming.test.gloo +28 -30
- data/test.gloo/lang/ops.test.gloo +53 -55
- data/test.gloo/lang/shorthand.test.gloo +15 -17
- data/test.gloo/math/add.test.gloo +40 -42
- data/test.gloo/math/div.test.gloo +23 -25
- data/test.gloo/math/mult.test.gloo +23 -25
- data/test.gloo/math/sub.test.gloo +23 -25
- data/test.gloo/objs/alias.test.gloo +15 -17
- data/test.gloo/objs/bool.test.gloo +54 -56
- data/test.gloo/objs/can.test.gloo +33 -35
- data/test.gloo/objs/cipher.test.gloo +39 -41
- data/test.gloo/objs/decimal.test.gloo +27 -29
- data/test.gloo/objs/erb.test.gloo +47 -49
- data/test.gloo/objs/file.test.gloo +68 -70
- data/test.gloo/objs/function.test.gloo +37 -39
- data/test.gloo/objs/int.test.gloo +54 -56
- data/test.gloo/objs/json.test.gloo +56 -58
- data/test.gloo/objs/obj.test.gloo +68 -48
- data/test.gloo/objs/outline.test.gloo +48 -50
- data/test.gloo/objs/password.test.gloo +34 -36
- data/test.gloo/objs/repeat.test.gloo +42 -44
- data/test.gloo/objs/script.test.gloo +13 -15
- data/test.gloo/objs/string.test.gloo +82 -84
- data/test.gloo/objs/text.test.gloo +90 -92
- data/test.gloo/objs/untyped.test.gloo +36 -38
- data/test.gloo/objs/uri.test.gloo +37 -39
- data/test.gloo/verbs/break.test.gloo +12 -14
- data/test.gloo/verbs/check.test.gloo +22 -24
- data/test.gloo/verbs/context.test.gloo +11 -13
- data/test.gloo/verbs/create.test.gloo +7 -9
- data/test.gloo/verbs/eval.test.gloo +10 -12
- data/test.gloo/verbs/exists.test.gloo +43 -45
- data/test.gloo/verbs/if.test.gloo +8 -10
- data/test.gloo/verbs/invoke.test.gloo +73 -75
- data/test.gloo/verbs/list.test.gloo +21 -23
- data/test.gloo/verbs/load.test.gloo +27 -21
- data/test.gloo/verbs/log.test.gloo +7 -9
- data/test.gloo/verbs/move.test.gloo +12 -14
- data/test.gloo/verbs/put.test.gloo +10 -12
- data/test.gloo/verbs/reload.test.gloo +30 -32
- data/test.gloo/verbs/run.test.gloo +8 -10
- data/test.gloo/verbs/save.test.gloo +90 -94
- data/test.gloo/verbs/show.test.gloo +26 -28
- data/test.gloo/verbs/tell.test.gloo +8 -10
- data/test.gloo/verbs/throw.test.gloo +31 -33
- data/test.gloo/verbs/unless.test.gloo +13 -15
- data/test.gloo/verbs/unload.test.gloo +10 -12
- metadata +1 -1
data/test.gloo/lang/it.test.gloo
CHANGED
|
@@ -4,38 +4,36 @@
|
|
|
4
4
|
# 'it' holds the result of the last statement that produced one.
|
|
5
5
|
#
|
|
6
6
|
|
|
7
|
-
tests [can] :
|
|
8
|
-
lang [can] :
|
|
9
|
-
it [can] :
|
|
7
|
+
tests.lang.it [can] :
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
n [int] : 5
|
|
10
|
+
r [string] :
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
set_by_the_previous_statement [test] :
|
|
13
|
+
description [string] : show, eval, tell and put all leave their result in it.
|
|
14
|
+
on_test [script] :
|
|
15
|
+
show 3 + 4
|
|
16
|
+
eval it = 7
|
|
17
|
+
assert "expected show to leave the evaluated value in it"
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
eval 10 * 2
|
|
20
|
+
eval it = 20
|
|
21
|
+
assert "expected eval to leave its result in it"
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
put 'hello' into ^^.r
|
|
24
|
+
eval it = 'hello'
|
|
25
|
+
assert "expected put to leave the stored value in it"
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
put 5 into ^^.n
|
|
28
|
+
tell ^^.n to inc
|
|
29
|
+
eval it = 6
|
|
30
|
+
assert "expected tell to leave the message result in it"
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
persists_across_statements_that_produce_nothing [test] :
|
|
33
|
+
description [string] : statements like a bare show or list leave it untouched.
|
|
34
|
+
on_test [script] :
|
|
35
|
+
eval 42
|
|
36
|
+
show
|
|
37
|
+
list ^^.n
|
|
38
|
+
eval it = 42
|
|
39
|
+
assert "expected it to survive statements that don't produce a result"
|
|
@@ -2,60 +2,58 @@
|
|
|
2
2
|
# Literal value tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
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
|
-
eval ^^.b = false
|
|
61
|
-
assert "expected FALSE to parse"
|
|
5
|
+
tests.lang.literal [can] :
|
|
6
|
+
|
|
7
|
+
s [string] :
|
|
8
|
+
i [integer] :
|
|
9
|
+
d [decimal] :
|
|
10
|
+
b [boolean] :
|
|
11
|
+
|
|
12
|
+
string_quote_styles [test] :
|
|
13
|
+
description [string] : single and double quotes both make a string; the other quote can appear inside.
|
|
14
|
+
on_test [script] :
|
|
15
|
+
put 'single quoted' into ^^.s
|
|
16
|
+
eval ^^.s = 'single quoted'
|
|
17
|
+
assert "expected single quotes to work"
|
|
18
|
+
|
|
19
|
+
put "double quoted" into ^^.s
|
|
20
|
+
eval ^^.s = 'double quoted'
|
|
21
|
+
assert "expected double quotes to work"
|
|
22
|
+
|
|
23
|
+
put "you're fine" into ^^.s
|
|
24
|
+
eval ^^.s = "you're fine"
|
|
25
|
+
assert "expected an apostrophe inside double quotes to be literal"
|
|
26
|
+
|
|
27
|
+
number_literals [test] :
|
|
28
|
+
description [string] : integer and decimal literals, including negatives.
|
|
29
|
+
on_test [script] :
|
|
30
|
+
put -5 into ^^.i
|
|
31
|
+
eval ^^.i = -5
|
|
32
|
+
assert "expected a negative integer literal"
|
|
33
|
+
|
|
34
|
+
put 3.14159 into ^^.d
|
|
35
|
+
eval ^^.d = 3.14159
|
|
36
|
+
assert "expected a decimal literal"
|
|
37
|
+
|
|
38
|
+
put -2.5 into ^^.d
|
|
39
|
+
eval ^^.d = -2.5
|
|
40
|
+
assert "expected a negative decimal literal"
|
|
41
|
+
|
|
42
|
+
boolean_literals_are_case_insensitive [test] :
|
|
43
|
+
description [string] : TRUE, true, False, FALSE all parse.
|
|
44
|
+
on_test [script] :
|
|
45
|
+
put TRUE into ^^.b
|
|
46
|
+
eval ^^.b = true
|
|
47
|
+
assert "expected TRUE to parse"
|
|
48
|
+
|
|
49
|
+
put true into ^^.b
|
|
50
|
+
eval ^^.b = true
|
|
51
|
+
assert "expected true to parse"
|
|
52
|
+
|
|
53
|
+
put False into ^^.b
|
|
54
|
+
eval ^^.b = false
|
|
55
|
+
assert "expected False to parse"
|
|
56
|
+
|
|
57
|
+
put FALSE into ^^.b
|
|
58
|
+
eval ^^.b = false
|
|
59
|
+
assert "expected FALSE to parse"
|
|
@@ -6,28 +6,26 @@
|
|
|
6
6
|
#
|
|
7
7
|
load lib yaml
|
|
8
8
|
|
|
9
|
-
tests [can] :
|
|
10
|
-
lang [can] :
|
|
11
|
-
load_lib_directive [can] :
|
|
9
|
+
tests.lang.load_lib_directive [can] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
# this declaration only parses because 'load lib yaml' above
|
|
12
|
+
# registered the type before the loader got here
|
|
13
|
+
cfg [yaml] :
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
library_type_is_available [test] :
|
|
16
|
+
description [string] : a load lib directive at the top of the file registers the library's types.
|
|
17
|
+
on_test [script] :
|
|
18
|
+
exists? object yaml
|
|
19
|
+
assert "expected the yaml type to be registered by the directive"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
exists? object yml
|
|
22
|
+
assert "expected the yaml short name to be registered too"
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
typed_object_was_created [test] :
|
|
25
|
+
description [string] : an object of the library's type declared in the same file exists.
|
|
26
|
+
on_test [script] :
|
|
27
|
+
exists? instance tests.lang.load_lib_directive.cfg
|
|
28
|
+
assert "expected the [yaml] object to have been created during load"
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
check tests.lang.load_lib_directive.cfg for responds_to? ( 'load' )
|
|
31
|
+
assert "expected it to be a real yaml object that responds to load"
|
|
@@ -2,43 +2,41 @@
|
|
|
2
2
|
# Object naming tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
lang [can] :
|
|
7
|
-
naming [can] :
|
|
5
|
+
tests.lang.naming [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
dup [string] : first
|
|
8
|
+
dup [string] : second
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
Alpha [string] : mixed case
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
1 [string] : numeric name
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
string [string] : a type keyword as a name
|
|
15
|
+
put [string] : a verb keyword as a name
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
first_of_a_duplicate_name_wins [test] :
|
|
18
|
+
description [string] : when two siblings share a name, the path always reaches the first.
|
|
19
|
+
on_test [script] :
|
|
20
|
+
eval ^^.dup = 'first'
|
|
21
|
+
assert "expected the first 'dup' to be the one reached"
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
path_lookup_is_case_insensitive [test] :
|
|
24
|
+
description [string] : a pathname segment matches a name regardless of case.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
eval tests.lang.naming.alpha = 'mixed case'
|
|
27
|
+
assert "expected lower-case lookup to find 'Alpha'"
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
eval tests.lang.naming.ALPHA = 'mixed case'
|
|
30
|
+
assert "expected upper-case lookup to find 'Alpha'"
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
numeric_and_keyword_names [test] :
|
|
33
|
+
description [string] : digits and reserved-looking words are valid object names.
|
|
34
|
+
on_test [script] :
|
|
35
|
+
eval tests.lang.naming.1 = 'numeric name'
|
|
36
|
+
assert "expected a numeric name to work"
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
eval ^^.string = 'a type keyword as a name'
|
|
39
|
+
assert "expected a type keyword to be usable as a name"
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
eval ^^.put = 'a verb keyword as a name'
|
|
42
|
+
assert "expected a verb keyword to be usable as a name"
|
|
@@ -2,78 +2,76 @@
|
|
|
2
2
|
# Gloo System tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
lang [can] :
|
|
7
|
-
ops [can] :
|
|
5
|
+
tests.lang.ops [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
confirm_eq_ops [test] :
|
|
8
|
+
description [string] : Confirm equality operations.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
eval 1 = 1
|
|
11
|
+
assert "expected 1 = 1"
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
eval 2 = 3
|
|
14
|
+
refute "expected 2 to not equal 3"
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
eval "hello" = "hello"
|
|
17
|
+
assert "expected 'hello' = 'hello'"
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
eval "hello" = "world"
|
|
20
|
+
refute "expected 'hello' to not equal 'world'"
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
confirm_not_eq_ops [test] :
|
|
23
|
+
description [string] : Confirm not equal operations.
|
|
24
|
+
on_test [script] :
|
|
25
|
+
eval 1 != 2
|
|
26
|
+
assert "expected 1 != 2"
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
eval 1 != 1
|
|
29
|
+
refute "expected 1 to not equal 1"
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
eval "hello" != "world"
|
|
32
|
+
assert "expected 'hello' != 'world'"
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
eval "hello" != "hello"
|
|
35
|
+
refute "expected 'hello' to not equal 'hello'"
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
confirm_gt_ops [test] :
|
|
38
|
+
description [string] : Confirm greater than operations.
|
|
39
|
+
on_test [script] :
|
|
40
|
+
eval 2 > 1
|
|
41
|
+
assert "expected 2 > 1"
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
eval 1 > 2
|
|
44
|
+
refute "expected 1 to not be greater than 2"
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
eval 2 > 2
|
|
47
|
+
refute "expected 2 to not be greater than 2"
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
eval 3 >= 2
|
|
50
|
+
assert "expected 3 >= 2"
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
eval 2 >= 3
|
|
53
|
+
refute "expected 2 to not be greater than or equal to 3"
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
eval 2 >= 2
|
|
56
|
+
assert "expected 2 >= 2"
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
confirm_lt_ops [test] :
|
|
59
|
+
description [string] : Confirm less than operations.
|
|
60
|
+
on_test [script] :
|
|
61
|
+
eval 1 < 2
|
|
62
|
+
assert "expected 1 < 2"
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
eval 2 < 1
|
|
65
|
+
refute "expected 2 to not be less than 1"
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
eval 1 < 1
|
|
68
|
+
refute "expected 1 to not be less than 1"
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
eval 1 <= 2
|
|
71
|
+
assert "expected 1 <= 2"
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
eval 2 <= 1
|
|
74
|
+
refute "expected 2 to not be less than or equal to 1"
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
eval 1 <= 1
|
|
77
|
+
assert "expected 1 <= 1"
|
|
@@ -6,24 +6,22 @@
|
|
|
6
6
|
# under the last one.
|
|
7
7
|
#
|
|
8
8
|
|
|
9
|
-
tests [can] :
|
|
10
|
-
lang [can] :
|
|
11
|
-
shorthand [can] :
|
|
9
|
+
tests.lang.shorthand [can] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
page.core.title [string] : Home
|
|
12
|
+
page.core.count [int] : 3
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
builds_the_container_chain [test] :
|
|
15
|
+
description [string] : a dotted name creates a container for each prefix segment.
|
|
16
|
+
on_test [script] :
|
|
17
|
+
eval ^^.page.core.title = 'Home'
|
|
18
|
+
assert "expected the shorthand-built value to be reachable"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
check ^^.page for contains?
|
|
21
|
+
assert "expected 'page' to be a real container"
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
reuses_an_existing_prefix [test] :
|
|
24
|
+
description [string] : a second shorthand line reuses the same containers.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
eval ^^.page.core.count = 3
|
|
27
|
+
assert "expected both shorthand lines to share the 'core' container"
|
|
@@ -2,45 +2,43 @@
|
|
|
2
2
|
# Addition tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
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
|
-
eval 1.5 + 2.5 = 3
|
|
46
|
-
refute 'expected 1.5 + 2.5 != 3'
|
|
5
|
+
tests.math.add [can] :
|
|
6
|
+
|
|
7
|
+
# #
|
|
8
|
+
# # Use this test to verify that errors cause the test to fail.
|
|
9
|
+
# #
|
|
10
|
+
# math_fail [test] :
|
|
11
|
+
# description [string] : Expect bad math to fail
|
|
12
|
+
# on_test [script] :
|
|
13
|
+
# eval 2 + 3 = 2
|
|
14
|
+
# assert 'that is wrong!'
|
|
15
|
+
|
|
16
|
+
add_ints [test] :
|
|
17
|
+
description [string] : Add two integers
|
|
18
|
+
on_test [script] :
|
|
19
|
+
eval 2 + 3 = 5
|
|
20
|
+
assert 'expected 2 + 3 = 5'
|
|
21
|
+
|
|
22
|
+
eval 10 + 20 = 30
|
|
23
|
+
assert 'expected 10 + 20 = 30'
|
|
24
|
+
|
|
25
|
+
eval 100 + 200 = 300
|
|
26
|
+
assert 'expected 100 + 200 = 300'
|
|
27
|
+
|
|
28
|
+
eval 1 + 2 = 4
|
|
29
|
+
refute 'expected 1 + 2 != 4'
|
|
30
|
+
|
|
31
|
+
add_decimals [test] :
|
|
32
|
+
description [string] : Add two decimals
|
|
33
|
+
on_test [script] :
|
|
34
|
+
eval 1.5 + 5.5 = 7
|
|
35
|
+
assert 'expected 1.5 + 5.5 = 7'
|
|
36
|
+
|
|
37
|
+
eval 10.5 + 20.5 = 31
|
|
38
|
+
assert 'expected 10.5 + 20.5 = 31'
|
|
39
|
+
|
|
40
|
+
eval 100.5 + 200.5 = 301
|
|
41
|
+
assert 'expected 100.5 + 200.5 = 301'
|
|
42
|
+
|
|
43
|
+
eval 1.5 + 2.5 = 3
|
|
44
|
+
refute 'expected 1.5 + 2.5 != 3'
|
|
@@ -2,36 +2,34 @@
|
|
|
2
2
|
# Division tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
math [can] :
|
|
7
|
-
div [can] :
|
|
5
|
+
tests.math.div [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
div_ints [test] :
|
|
8
|
+
description [string] : Divide two integers
|
|
9
|
+
on_test [script] :
|
|
10
|
+
eval 6 / 3 = 2
|
|
11
|
+
assert 'expected 6 / 3 = 2'
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
eval 20 / 10 = 2
|
|
14
|
+
assert 'expected 20 / 10 = 2'
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
eval 200 / 100 = 2
|
|
17
|
+
assert 'expected 200 / 100 = 2'
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
eval 1 / 3 = 1
|
|
20
|
+
refute 'expected 1 / 3 != 1'
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
div_decimals [test] :
|
|
23
|
+
description [string] : Divide two decimals
|
|
24
|
+
on_test [script] :
|
|
25
|
+
eval 10.2 / 2 = 5.1
|
|
26
|
+
assert 'expected 10.2 / 2 = 5.1'
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
eval 10.5 / 5 = 2.1
|
|
29
|
+
assert 'expected 10.5 / 5 = 2.1'
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
eval 100.5 / 200.5 = 0.5
|
|
32
|
+
assert 'expected 100.5 / 200.5 = 0.5'
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
eval 1.5 / 10.5 = 0.1
|
|
35
|
+
refute 'expected 1.5 / 10.5 != 0.1'
|