testing/auto/iterables.a
raw| 1 | |
| 2 | !macro a @r { |
| 3 | !if @r != 1 { |
| 4 | !error "assertion failed" |
| 5 | } |
| 6 | } |
| 7 | |
| 8 | squares = [1, 4, 9] |
| 9 | emptylist = [] |
| 10 | primes = [2, 3, 5, 7] |
| 11 | +a primes + emptylist + squares == [2,3,5,7,1,4,9] |
| 12 | |
| 13 | somestring = "Arthur" |
| 14 | emptystring = "" |
| 15 | otherstring = "Ford" |
| 16 | +a otherstring + emptystring + somestring == "FordArthur" |
| 17 | |
| 18 | !set collection = [] |
| 19 | !for c in "Trillian" { |
| 20 | !set collection = collection + [c] |
| 21 | } |
| 22 | +a collection == [84, 114, 105, 108, 108, 105, 97, 110] |