MCPcopy
hub / github.com/kopia/kopia / TestInt64

Function TestInt64

internal/contentlog/logparam/logparam_test.go:90–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestInt64(t *testing.T) {
91 tests := []struct {
92 name string
93 key string
94 value int64
95 expected map[string]any
96 }{
97 {
98 name: "positive int64",
99 key: "count",
100 value: 123456789,
101 expected: map[string]any{
102 "count": 123456789.0,
103 },
104 },
105 {
106 name: "negative int64",
107 key: "negative",
108 value: -987654321,
109 expected: map[string]any{
110 "negative": -987654321.0,
111 },
112 },
113 {
114 name: "zero int64",
115 key: "zero",
116 value: 0,
117 expected: map[string]any{
118 "zero": 0.0,
119 },
120 },
121 {
122 name: "max int64",
123 key: "max",
124 value: 9223372036854775807,
125 expected: map[string]any{
126 "max": 9223372036854775807.0,
127 },
128 },
129 {
130 name: "min int64",
131 key: "min",
132 value: -9223372036854775808,
133 expected: map[string]any{
134 "min": -9223372036854775808.0,
135 },
136 },
137 }
138
139 for _, tt := range tests {
140 t.Run(tt.name, func(t *testing.T) {
141 // Test memory allocations
142 allocs := testing.AllocsPerRun(100, func() {
143 _ = Int64(tt.key, tt.value)
144 })
145 require.Equal(t, float64(0), allocs, "Int64() should not allocate memory")
146
147 // Test output format

Callers

nothing calls this directly

Calls 9

ReleaseMethod · 0.95
BeginObjectMethod · 0.95
EndObjectMethod · 0.95
GetBufferForTestingMethod · 0.95
NewJSONWriterFunction · 0.92
Int64Function · 0.85
EqualMethod · 0.80
RunMethod · 0.65
WriteValueToMethod · 0.65

Tested by

no test coverage detected