Test FuncMatch()
(t *testing.T)
| 160 | |
| 161 | // Test FuncMatch() |
| 162 | func TestIntSetFuncMatch(t *testing.T) { |
| 163 | s := Create(1, 2, 3, 4, 5, 6) |
| 164 | |
| 165 | // Find all even numbers |
| 166 | result := s.FuncMatch(func(val, _ int) bool { |
| 167 | return val%2 == 0 |
| 168 | }, 0) |
| 169 | |
| 170 | expected := Create(2, 4, 6) |
| 171 | if !result.Equals(expected) { |
| 172 | t.Fatalf("expected even numbers {2, 4, 6}, got: %v", result) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // Test ApplyFunc() |
| 177 | func TestIntSetApplyFunc(t *testing.T) { |