(t *testing.T, ms mapSlice)
| 30 | } |
| 31 | |
| 32 | func checkWithMapSlice(t *testing.T, ms mapSlice) { |
| 33 | fm := faststringmap.NewUint32Store(ms) |
| 34 | |
| 35 | for _, k := range ms.in { |
| 36 | check := func(actV uint32, ok bool) { |
| 37 | if !ok { |
| 38 | t.Errorf("%q not present", k) |
| 39 | } else if actV != ms.m[k] { |
| 40 | t.Errorf("got %d want %d for %q", actV, ms.m[k], k) |
| 41 | } |
| 42 | } |
| 43 | check(fm.LookupString(k)) |
| 44 | check(fm.LookupBytes([]byte(k))) |
| 45 | } |
| 46 | |
| 47 | for _, k := range ms.out { |
| 48 | check := func(actV uint32, ok bool) { |
| 49 | if ok { |
| 50 | t.Errorf("%q present when not expected, got %d", k, actV) |
| 51 | } |
| 52 | } |
| 53 | check(fm.LookupString(k)) |
| 54 | check(fm.LookupBytes([]byte(k))) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | type mapSlice struct { |
| 59 | m map[string]uint32 |
no test coverage detected