(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestIsGreaterThan(t *testing.T) { |
| 8 | oneInt := IntegerValue{ |
| 9 | Value: 0, |
| 10 | } |
| 11 | twoInt := IntegerValue{ |
| 12 | Value: 2, |
| 13 | } |
| 14 | oneString := StringValue{ |
| 15 | Value: "aaa", |
| 16 | } |
| 17 | twoString := StringValue{ |
| 18 | Value: "aab", |
| 19 | } |
| 20 | oneNull := NullValue{} |
| 21 | twoNull := NullValue{} |
| 22 | |
| 23 | if oneInt.isGreaterThan(twoInt) { |
| 24 | t.Errorf("0 shouldn't be greater than 2") |
| 25 | } |
| 26 | |
| 27 | if !twoInt.isGreaterThan(oneInt) { |
| 28 | t.Errorf("0 shouldn't be greater than 2") |
| 29 | } |
| 30 | |
| 31 | if oneString.isGreaterThan(twoString) { |
| 32 | t.Errorf("aaa shouldn't be greater than aab") |
| 33 | } |
| 34 | |
| 35 | if !twoString.isGreaterThan(oneString) { |
| 36 | t.Errorf("1 shouldn't be greater than 2") |
| 37 | } |
| 38 | |
| 39 | if twoNull.isGreaterThan(oneNull) { |
| 40 | t.Errorf("null is not greater than null") |
| 41 | } |
| 42 | |
| 43 | if !oneInt.isGreaterThan(oneNull) { |
| 44 | t.Errorf("Any Int value cannot be smaller than null") |
| 45 | } |
| 46 | |
| 47 | if !oneString.isGreaterThan(oneNull) { |
| 48 | t.Errorf("Any String value cannot be smaller than null") |
| 49 | } |
| 50 | |
| 51 | if oneNull.isGreaterThan(oneInt) { |
| 52 | t.Errorf("Null cannot be greater than any int value") |
| 53 | } |
| 54 | |
| 55 | if oneNull.isGreaterThan(oneString) { |
| 56 | t.Errorf("Null cannot be greater than any string value") |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | func TestIsSmallerThan(t *testing.T) { |
| 61 | oneInt := IntegerValue{ |
nothing calls this directly
no test coverage detected