cuelang.org/go@v0.10.1/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 mul7: 10 15 mul7: math.MultipleOf(2) 16 mul8: 9 & math.MultipleOf(3) 17 18 r0: math.Round(2.5) 19 r1: math.Round(-2.5) 20 r2: math.RoundToEven(2.5) 21 r3: math.RoundToEven(-2.5) 22 23 floorE1: math.Floor(3, 5) 24 floorE2: math.Floor("foo") 25 26 floor0: math.Floor(math.Pi) 27 floor1: math.Floor(2.9) 28 floor2: math.Floor(-2.2) 29 floor3: math.Floor(2900) 30 floor4: math.Floor(29e2) 31 32 ceil0: math.Ceil(2.5) 33 ceil1: math.Ceil(-2.2) 34 35 trunc0: math.Trunc(2.5) 36 trunc1: math.Trunc(-2.9) 37 -- out/math -- 38 Errors: 39 mul2: error in call to math.MultipleOf: division by zero: 40 ./in.cue:6:7 41 floorE1: too many arguments in call to math.Floor (have 2, want 1): 42 ./in.cue:20:10 43 floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor: 44 ./in.cue:21:21 45 46 Result: 47 mul0: true 48 mul1: false 49 // TODO(errors): ensure path is included for the following error. 50 mul2: _|_ // mul2: error in call to math.MultipleOf: division by zero 51 mul3: false 52 mul4: true 53 mul5: true 54 mul6: true 55 mul7: 10 56 mul8: 9 57 r0: 3 58 r1: -3 59 r2: 2 60 r3: -2 61 floorE1: _|_ // floorE1: too many arguments in call to math.Floor (have 2, want 1) 62 floorE2: _|_ // floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor 63 floor0: 3 64 floor1: 2 65 floor2: -3 66 floor3: 2900 67 floor4: 2900 68 ceil0: 3 69 ceil1: -2 70 trunc0: 2 71 trunc1: -2