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

Function TestCount64

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

Source from the content-addressed store, hash-verified

31}
32
33func TestCount64(t *testing.T) {
34 assert := assert.New(t)
35
36 var value uint64
37 var overflow bool
38
39 c := counts.NewCount64(0)
40 value, overflow = c.ToUint64()
41 assert.Equalf(uint64(0), value, "NewCount64(0).ToUint64() should be 0")
42 assert.False(overflow, "NewCount64(0).ToUint64() does not overflow")
43
44 c.Increment(counts.Count64(0xf000000000000000))
45 value, overflow = c.ToUint64()
46 assert.Equalf(uint64(0xf000000000000000), value, "Count64(0xf000000000000000).ToUint64() value")
47 assert.False(overflow, "NewCount64(0xf000000000000000).ToUint64() does not overflow")
48
49 c.Increment(counts.Count64(0xf000000000000000))
50 value, overflow = c.ToUint64()
51 assert.Equalf(uint64(0xffffffffffffffff), value, "Count64(0xffffffffffffffff).ToUint64() value")
52 assert.True(overflow, "NewCount64(0xffffffffffffffff).ToUint64() overflows")
53}

Callers

nothing calls this directly

Calls 4

ToUint64Method · 0.95
IncrementMethod · 0.95
NewCount64Function · 0.92
Count64TypeAlias · 0.92

Tested by

no test coverage detected