github.com/mem/u-root@v2.0.1-0.20181004165302-9b18b4636a33+incompatible/cmds/elvish/eval/builtin_fn_num_test.go (about) 1 package eval 2 3 import "testing" 4 5 func TestBuiltinFnNum(t *testing.T) { 6 runTests(t, []Test{ 7 That("< 1 2 3").Puts(true), 8 That("< 1 3 2").Puts(false), 9 That("<= 1 1 2").Puts(true), 10 That("<= 1 2 1").Puts(false), 11 That("== 1 1 1").Puts(true), 12 That("== 1 2 1").Puts(false), 13 That("!= 1 2 1").Puts(true), 14 That("!= 1 1 2").Puts(false), 15 That("> 3 2 1").Puts(true), 16 That("> 3 1 2").Puts(false), 17 That(">= 3 3 2").Puts(true), 18 That(">= 3 2 3").Puts(false), 19 20 // TODO test more edge cases 21 That("+ 233100 233").Puts("233333"), 22 That("- 233333 233100").Puts("233"), 23 That("- 233").Puts("-233"), 24 That("* 353 661").Puts("233333"), 25 That("/ 233333 353").Puts("661"), 26 That("/ 1 0").Puts("+Inf"), 27 That("^ 16 2").Puts("256"), 28 That("% 23 7").Puts("2"), 29 }) 30 }