github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/pkg/math/testdata/round.txtar (about) 1 # generated from the original tests. 2 # Henceforth it may be nicer to group tests into separate files. 3 -- in.cue -- 4 import "math" 5 6 mul0: math.MultipleOf(4, 2) 7 mul1: math.MultipleOf(5, 2) 8 // TODO(errors): ensure path is included for the following error. 9 mul2: math.MultipleOf(5, 0) 10 mul3: math.MultipleOf(100, 1.00001) 11 mul4: math.MultipleOf(1, 1) 12 mul5: math.MultipleOf(5, 2.5) 13 mul6: math.MultipleOf(100e100, 10) 14 15 r0: math.Round(2.5) 16 r1: math.Round(-2.5) 17 r2: math.RoundToEven(2.5) 18 r3: math.RoundToEven(-2.5) 19 20 floorE1: math.Floor(3, 5) 21 floorE2: math.Floor("foo") 22 23 floor0: math.Floor(math.Pi) 24 floor1: math.Floor(2.9) 25 floor2: math.Floor(-2.2) 26 floor3: math.Floor(2900) 27 floor4: math.Floor(29e2) 28 29 ceil0: math.Ceil(2.5) 30 ceil1: math.Ceil(-2.2) 31 32 trunc0: math.Trunc(2.5) 33 trunc1: math.Trunc(-2.9) 34 -- out/math -- 35 Errors: 36 error in call to math.MultipleOf: division by zero: 37 ./in.cue:6:7 38 floorE1: too many arguments in call to math.Floor (have 2, want 1): 39 ./in.cue:17:10 40 floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor: 41 ./in.cue:18:21 42 43 Result: 44 mul0: true 45 mul1: false 46 // TODO(errors): ensure path is included for the following error. 47 mul2: _|_ // error in call to math.MultipleOf: division by zero 48 mul3: false 49 mul4: true 50 mul5: true 51 mul6: true 52 r0: 3 53 r1: -3 54 r2: 2 55 r3: -2 56 floorE1: _|_ // floorE1: too many arguments in call to math.Floor (have 2, want 1) 57 floorE2: _|_ // floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor 58 floor0: 3 59 floor1: 2 60 floor2: -3 61 floor3: 2900 62 floor4: 2900 63 ceil0: 3 64 ceil1: -2 65 trunc0: 2 66 trunc1: -2 67