Debian Codegraph @

src/reflect/map_swiss_test.go

raw
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build goexperiment.swissmap
6
7 package reflect_test
8
9 import (
10 "reflect"
11 "testing"
12 )
13
14 func testGCBitsMap(t *testing.T) {
15 // Unlike old maps, we don't manually construct GC data for swiss maps,
16 // instead using the public reflect API in groupAndSlotOf.
17 }
18
19 // See also runtime_test.TestGroupSizeZero.
20 func TestGroupSizeZero(t *testing.T) {
21 st := reflect.TypeFor[struct{}]()
22 grp := reflect.MapGroupOf(st, st)
23
24 // internal/runtime/maps when create pointers to slots, even if slots
25 // are size 0. We should have reserved an extra word to ensure that
26 // pointers to the zero-size type at the end of group are valid.
27 if grp.Size() <= 8 {
28 t.Errorf("Group size got %d want >8", grp.Size())
29 }
30 }