(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestNumberParse(t *testing.T) { |
| 68 | t.Parallel() |
| 69 | for _, test := range numberTests { |
| 70 | n, err := expr.NewNumberStr(test.text) |
| 71 | ok := test.isInt || test.isFloat |
| 72 | if ok && err != nil { |
| 73 | t.Errorf("unexpected error for %q: %s", test.text, err) |
| 74 | continue |
| 75 | } |
| 76 | if !ok && err == nil { |
| 77 | t.Errorf("expected error for %q", test.text) |
| 78 | continue |
| 79 | } |
| 80 | if !ok { |
| 81 | if *VerboseTests { |
| 82 | u.Debugf("%s\n\t%s", test.text, err) |
| 83 | } |
| 84 | continue |
| 85 | } |
| 86 | if test.isInt && !n.IsInt { |
| 87 | t.Errorf("did not expect unsigned integer for %q", test.text) |
| 88 | } |
| 89 | if test.isFloat { |
| 90 | if !n.IsFloat { |
| 91 | t.Errorf("expected float for %q", test.text) |
| 92 | } |
| 93 | if n.Float64 != test.float64 { |
| 94 | t.Errorf("float64 for %q should be %g Is %g", test.text, test.float64, n.Float64) |
| 95 | } |
| 96 | } else if n.IsFloat { |
| 97 | t.Errorf("did not expect float for %q", test.text) |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | type exprTest struct { |
| 103 | qlText string |
nothing calls this directly
no test coverage detected