Skip to content

Commit

Permalink
Improve sum test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Nov 21, 2024
1 parent 5c78033 commit 7c38205
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions conformance/system_macros/sum.ion
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(produces 0)))

(ion_1_1 "sum produces a single, unannotated integer that is the sum of"
(each "two integers"
(each "integers"
(text "(:sum -1 4)")
(text "(:sum 0 3)")
(text "(:sum 1 2)")
Expand All @@ -28,12 +28,13 @@
(text "(:sum a::1 2)")
(text "(:sum 1 b::2)")
(text "(:sum a::1 b::2)")
// Values that produce an integer
"expressions that produce integers"
(text "(:sum (:values 1) 2)")
(text "(:sum 1 (:values 2))")
// ...including other sums
"other sums"
(text "(:sum (:sum 1 1) 1)")
(text "(:sum 1 (:sum 1 1))")
(text "(:sum (:sum -4 3) (:sum 2 2))")
(produces 3)))

(ion_1_1 "sum is commutative"
Expand All @@ -45,7 +46,12 @@
(each (text "(:sum -2 4)") (text "(:sum 4 -2)") (produces 2)))

(ion_1_1 "arguments may not be"
(each "any null"
(each "less than two integers"
(text "(:sum)")
(text "(:sum 1)")
"more than two integers"
(text "(:sum 1 2 3)")
"any null"
(text "(:sum 1 null)")
(text "(:sum 1 null.int)")
(text "(:sum 1 null.float)")
Expand Down Expand Up @@ -73,4 +79,6 @@
(text '''(:sum 1 '3')''')
(text '''(:sum "3" 2)''')
(text '''(:sum '3' 2)''')
"a single expression that produces two integers"
(text "(:sum (:values 1 3))")
(signals "invalid argument")))

0 comments on commit 7c38205

Please sign in to comment.