(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestSerialNumberSetSmoke(t *testing.T) { |
| 75 | const testFile = ` |
| 76 | 01:00:00:00:00 # test |
| 77 | # test 2 |
| 78 | 03 |
| 79 | 03 |
| 80 | |
| 81 | 00 |
| 82 | 01 |
| 83 | 02` |
| 84 | testcases := []serialNumberSetTestcase{ |
| 85 | { |
| 86 | input: big.NewInt(1 << 32), |
| 87 | output: true, |
| 88 | }, |
| 89 | { |
| 90 | input: big.NewInt(0), |
| 91 | output: true, |
| 92 | }, |
| 93 | { |
| 94 | input: big.NewInt(1), |
| 95 | output: true, |
| 96 | }, |
| 97 | { |
| 98 | input: big.NewInt(2), |
| 99 | output: true, |
| 100 | }, |
| 101 | { |
| 102 | input: big.NewInt(3), |
| 103 | output: true, |
| 104 | }, |
| 105 | { |
| 106 | input: big.NewInt(4), |
| 107 | output: false, |
| 108 | }, |
| 109 | { |
| 110 | input: big.NewInt(-2), |
| 111 | output: true, |
| 112 | }, |
| 113 | } |
| 114 | s, err := newSerialNumberSetFromReader(strings.NewReader(testFile), nil) |
| 115 | if err != nil { |
| 116 | t.Fatalf("unable to load test set: %v", err) |
| 117 | } |
| 118 | for i, testcase := range testcases { |
| 119 | t.Run(fmt.Sprintf("Testcase[%d]", i), func(t *testing.T) { |
| 120 | out := s.Has(testcase.input) |
| 121 | if out != testcase.output { |
| 122 | t.Fatalf("expected %v, got %v", testcase.output, out) |
| 123 | } |
| 124 | }) |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | func TestSerialNumberSetEmpty(t *testing.T) { |
| 129 | const testFile = "" |
nothing calls this directly
no test coverage detected