MCPcopy
hub / github.com/github/git-sizer / TestCount32

Function TestCount32

counts/counts_test.go:11–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestCount32(t *testing.T) {
12 assert := assert.New(t)
13
14 var value uint64
15 var overflow bool
16
17 c := counts.NewCount32(0)
18 value, overflow = c.ToUint64()
19 assert.Equalf(uint64(0), value, "NewCount32(0).ToUint64() should be 0")
20 assert.False(overflow, "NewCount32(0).ToUint64() does not overflow")
21
22 c.Increment(counts.Count32(0xf0000000))
23 value, overflow = c.ToUint64()
24 assert.Equalf(uint64(0xf0000000), value, "Count32(0xf0000000).ToUint64() value")
25 assert.False(overflow, "NewCount32(0xf0000000).ToUint64() does not overflow")
26
27 c.Increment(counts.Count32(0xf0000000))
28 value, overflow = c.ToUint64()
29 assert.Equalf(uint64(0xffffffff), value, "Count32(0xffffffff).ToUint64() value")
30 assert.True(overflow, "NewCount32(0xffffffff).ToUint64() overflows")
31}
32
33func TestCount64(t *testing.T) {
34 assert := assert.New(t)

Callers

nothing calls this directly

Calls 4

ToUint64Method · 0.95
IncrementMethod · 0.95
NewCount32Function · 0.92
Count32TypeAlias · 0.92

Tested by

no test coverage detected