diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2024-08-13 20:51:43 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-11-18 20:35:37 +0000 |
| commit | 50f1888814e2a72cb368c145a0d1c2f3af7a2f05 (patch) | |
| tree | ac9b174cd020de6c26250b31dd5e7b37e463217b /src/sync/map_test.go | |
| parent | 5c7b7c7d60d7c20b102d70e713e605504353ab26 (diff) | |
| download | go-50f1888814e2a72cb368c145a0d1c2f3af7a2f05.tar.xz | |
sync: add HashTrieMap to Map tests and benchmarks
Also, rename Map benchmarks to make them easier to single out via
regexp.
Change-Id: I4dcb066745aba1c340f56050d08539ae2976274d
Reviewed-on: https://go-review.googlesource.com/c/go/+/606461
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/sync/map_test.go')
| -rw-r--r-- | src/sync/map_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sync/map_test.go b/src/sync/map_test.go index e1d0380765..cb820e7be2 100644 --- a/src/sync/map_test.go +++ b/src/sync/map_test.go @@ -5,6 +5,7 @@ package sync_test import ( + isync "internal/sync" "internal/testenv" "math/rand" "reflect" @@ -133,6 +134,10 @@ func applyDeepCopyMap(calls []mapCall) ([]mapResult, map[any]any) { return applyCalls(new(DeepCopyMap), calls) } +func applyHashTrieMap(calls []mapCall) ([]mapResult, map[any]any) { + return applyCalls(new(isync.HashTrieMap[any, any]), calls) +} + func TestMapMatchesRWMutex(t *testing.T) { if err := quick.CheckEqual(applyMap, applyRWMutexMap, nil); err != nil { t.Error(err) @@ -145,6 +150,12 @@ func TestMapMatchesDeepCopy(t *testing.T) { } } +func TestMapMatchesHashTrieMap(t *testing.T) { + if err := quick.CheckEqual(applyMap, applyHashTrieMap, nil); err != nil { + t.Error(err) + } +} + func TestConcurrentRange(t *testing.T) { const mapSize = 1 << 10 |
