Skip to content

Commit

Permalink
Adds suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Nov 15, 2024
1 parent cd0228f commit a28f91a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
8 changes: 4 additions & 4 deletions conformance/system_macros/default.ion
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
(then "an expression that produces nothing"
(text "(:default (:values) (::))")
(produces /*nothing*/))
(then "an expression that produces a single value"
(then "an expression that produces a single value"
(text "(:default (:values 1) (::))")
(produces 1))
(then "an expression that produces multiple values"
(then "an expression that produces multiple values"
(text "(:default (:values 1 2 3) (::))")
(produces 1 2 3)))

Expand All @@ -76,9 +76,9 @@
(then "an expression that produces nothing"
(text "(:default (::) (:values))")
(produces /*nothing*/))
(then "an expression that produces a single value"
(then "an expression that produces a single value"
(text "(:default (::) (:values 1))")
(produces 1))
(then "an expression that produces multiple values"
(then "an expression that produces multiple values"
(text "(:default (::) (:values 1 2 3))")
(produces 1 2 3)))
58 changes: 34 additions & 24 deletions conformance/system_macros/repeat.ion
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,40 @@
(binary "11 01 61 01 61 01")
(produces 1)))

(ion_1_1 "repeat will repeat things the correct number of times"
(then (text "(:repeat 1 0)") (produces 0))
(then (text "(:repeat 2 0)") (produces 0 0))
(then (text "(:repeat 3 0)") (produces 0 0 0))
(then (text "(:repeat 4 0)") (produces 0 0 0 0))
(then (text "(:repeat 5 0)") (produces 0 0 0 0 0)))
(ion_1_1 "repeat can produce"
(then "a single expression"
(then "0 times" (text "(:repeat 0 0)") (produces))
(then "1 times" (text "(:repeat 1 0)") (produces 0))
(then "2 times" (text "(:repeat 2 0)") (produces 0 0))
(then "3 times" (text "(:repeat 3 0)") (produces 0 0 0))
(then "4 times" (text "(:repeat 4 0)") (produces 0 0 0 0))
(then "5 times" (text "(:repeat 5 0)") (produces 0 0 0 0 0)))
(then "an empty expression group"
(each (text "(:repeat 0 (::))")
(text "(:repeat 1 (::))")
(text "(:repeat 2 (::))")
(text "(:repeat 3 (::))")
(text "(:repeat 4 (::))")
(produces /*nothing*/ )))
(then "an expression that produces no values"
(each (text "(:repeat 0 (:none))")
(text "(:repeat 1 (:none))")
(text "(:repeat 2 (:none))")
(text "(:repeat 3 (:none))")
(text "(:repeat 4 (:none))")
(produces /*nothing*/ )))
(then "an expression group with multiple values"
(then "0 times" (text "(:repeat 0 (:: 0 1))") (produces))
(then "1 times" (text "(:repeat 1 (:: 0 1))") (produces 0 1))
(then "2 times" (text "(:repeat 2 (:: 0 1))") (produces 0 1 0 1))
(then "3 times" (text "(:repeat 3 (:: 0 1))") (produces 0 1 0 1 0 1))
(then "4 times" (text "(:repeat 4 (:: 0 1))") (produces 0 1 0 1 0 1 0 1)))
(then "an expression that produces multiple values"
(then "0 times" (text "(:repeat 0 (:values 0 1))") (produces))
(then "1 times" (text "(:repeat 1 (:values 0 1))") (produces 0 1))
(then "2 times" (text "(:repeat 2 (:values 0 1))") (produces 0 1 0 1))
(then "3 times" (text "(:repeat 3 (:values 0 1))") (produces 0 1 0 1 0 1))
(then "4 times" (text "(:repeat 4 (:values 0 1))") (produces 0 1 0 1 0 1 0 1))) )

(ion_1_1 "repeat will ignore any annotations on the number of repetitions"
(then (text "(:repeat a::1 0)") (produces 0))
Expand All @@ -30,18 +58,6 @@
(then (text "(:repeat d::4 0)") (produces 0 0 0 0))
(then (text "(:repeat e::5 0)") (produces 0 0 0 0 0)))

(ion_1_1 "repeat can repeat an expression group with multiple values"
(then (text "(:repeat 1 (:: 0 1))") (produces 0 1))
(then (text "(:repeat 2 (:: 0 1))") (produces 0 1 0 1))
(then (text "(:repeat 3 (:: 0 1))") (produces 0 1 0 1 0 1))
(then (text "(:repeat 4 (:: 0 1))") (produces 0 1 0 1 0 1 0 1)))

(ion_1_1 "repeat can repeat an expression that produces multiple values"
(then (text "(:repeat 1 (:values 0 1))") (produces 0 1))
(then (text "(:repeat 2 (:values 0 1))") (produces 0 1 0 1))
(then (text "(:repeat 3 (:values 0 1))") (produces 0 1 0 1 0 1))
(then (text "(:repeat 4 (:values 0 1))") (produces 0 1 0 1 0 1 0 1)))

(ion_1_1 "repeat signals an error when"
(each "the number of repeats is not an integer"
(text "(:repeat 1d0 0)")
Expand All @@ -53,10 +69,4 @@
(text "(:repeat (:values 1 2) 0)")
"the number of repeats is negative"
(text "(:repeat -1 0)")
"the number of repeats is 0"
(text "(:repeat 0 0)")
"the expression to be repeated is empty"
(text "(:repeat 1)")
(text "(:repeat 1 (::))")
(text "(:repeat 1 (:none))")
(signals "invalid argument")))

0 comments on commit a28f91a

Please sign in to comment.