(t *testing.T)
| 149 | } |
| 150 | |
| 151 | func TestWordCounter(t *testing.T) { |
| 152 | w := NewWordCounter("test_words_count") |
| 153 | var wg sync.WaitGroup |
| 154 | for i := 0; i < 100; i++ { |
| 155 | wg.Add(1) |
| 156 | go func() { |
| 157 | defer wg.Done() |
| 158 | w.Add("foo") |
| 159 | w.Add("bar") |
| 160 | w.Add("foo") |
| 161 | }() |
| 162 | } |
| 163 | wg.Wait() |
| 164 | require.Equal(t, int64(2), w.Value()) |
| 165 | } |
| 166 | |
| 167 | func TestPanics(t *testing.T) { |
| 168 | require.Panics(t, func() { |