MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_FormatNumber

Function TestSpec_PublicAPI_FormatNumber

pkg/console/spec_test.go:259–282  ·  view source on GitHub ↗

TestSpec_PublicAPI_FormatNumber validates the documented behavior of FormatNumber. Specification: "Formats a large integer as a compact human-readable string using SI suffixes (k, M, B)."

(t *testing.T)

Source from the content-addressed store, hash-verified

257// TestSpec_PublicAPI_FormatNumber validates the documented behavior of FormatNumber.
258// Specification: "Formats a large integer as a compact human-readable string using SI suffixes (k, M, B)."
259func TestSpec_PublicAPI_FormatNumber(t *testing.T) {
260 tests := []struct {
261 name string
262 input int
263 expected string
264 }{
265 // From spec: FormatNumber(0) // "0"
266 {name: "zero", input: 0, expected: "0"},
267 // From spec: FormatNumber(999) // "999"
268 {name: "below 1000", input: 999, expected: "999"},
269 // From spec: FormatNumber(1500) // "1.50k"
270 {name: "1500 as 1.50k", input: 1500, expected: "1.50k"},
271 // From spec: FormatNumber(1_200_000) // "1.20M"
272 {name: "1.2M as 1.20M", input: 1_200_000, expected: "1.20M"},
273 }
274
275 for _, tt := range tests {
276 t.Run(tt.name, func(t *testing.T) {
277 result := FormatNumber(tt.input)
278 assert.Equal(t, tt.expected, result,
279 "FormatNumber(%d) should match documented output", tt.input)
280 })
281 }
282}
283
284// TestSpec_PublicAPI_FormatTokens validates the documented behavior of FormatTokens.
285// Specification: "Formats a token count as a compact human-readable string. Zero values

Callers

nothing calls this directly

Calls 2

FormatNumberFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected