| # generated from the original tests. |
| # Henceforth it may be nicer to group tests into separate files. |
| -- in.cue -- |
| import "math" |
| |
| mul0: math.MultipleOf(4, 2) |
| mul1: math.MultipleOf(5, 2) |
| // TODO(errors): ensure path is included for the following error. |
| mul2: math.MultipleOf(5, 0) |
| mul3: math.MultipleOf(100, 1.00001) |
| mul4: math.MultipleOf(1, 1) |
| mul5: math.MultipleOf(5, 2.5) |
| mul6: math.MultipleOf(100e100, 10) |
| |
| r0: math.Round(2.5) |
| r1: math.Round(-2.5) |
| r2: math.RoundToEven(2.5) |
| r3: math.RoundToEven(-2.5) |
| |
| floorE1: math.Floor(3, 5) |
| floorE2: math.Floor("foo") |
| |
| floor0: math.Floor(math.Pi) |
| floor1: math.Floor(2.9) |
| floor2: math.Floor(-2.2) |
| floor3: math.Floor(2900) |
| floor4: math.Floor(29E2) |
| |
| ceil0: math.Ceil(2.5) |
| ceil1: math.Ceil(-2.2) |
| |
| trunc0: math.Trunc(2.5) |
| trunc1: math.Trunc(-2.9) |
| |
| -- out/math -- |
| Errors: |
| error in call to math.MultipleOf: division by zero |
| floorE1: too many arguments in call to math.Floor (have 2, want 1): |
| ./in.cue:17:25 |
| floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor: |
| ./in.cue:18:21 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| mul0: (bool){ true } |
| mul1: (bool){ false } |
| mul2: (_|_){ |
| // [eval] error in call to math.MultipleOf: division by zero |
| } |
| mul3: (bool){ false } |
| mul4: (bool){ true } |
| mul5: (bool){ true } |
| mul6: (bool){ true } |
| r0: (int){ 3 } |
| r1: (int){ -3 } |
| r2: (int){ 2 } |
| r3: (int){ -2 } |
| floorE1: (_|_){ |
| // [eval] floorE1: too many arguments in call to math.Floor (have 2, want 1): |
| // ./in.cue:17:25 |
| } |
| floorE2: (_|_){ |
| // [eval] floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor: |
| // ./in.cue:18:21 |
| } |
| floor0: (int){ 3 } |
| floor1: (int){ 2 } |
| floor2: (int){ -3 } |
| floor3: (int){ 2900 } |
| floor4: (int){ 2900 } |
| ceil0: (int){ 3 } |
| ceil1: (int){ -2 } |
| trunc0: (int){ 2 } |
| trunc1: (int){ -2 } |
| } |