MCPcopy Create free account
hub / github.com/buger/jsonparser / TestRemoval3_MathematicalProof

Function TestRemoval3_MathematicalProof

dead_code_audit_test.go:268–280  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [formal]

(t *testing.T)

Source from the content-addressed store, hash-verified

266
267// Verifies: SYS-REQ-014 [formal]
268func TestRemoval3_MathematicalProof(t *testing.T) {
269 // Mathematical proof: decodeSingleUnicodeEscape computes
270 // h1<<12 + h2<<8 + h3<<4 + h4
271 // where h1..h4 are in [0, 15].
272 // Maximum: 15<<12 + 15<<8 + 15<<4 + 15 = 61440 + 3840 + 240 + 15 = 65535 = 0xFFFF
273 // This equals basicMultilingualPlaneOffset exactly.
274 // Therefore r <= basicMultilingualPlaneOffset is ALWAYS true.
275 maxR := rune(15<<12 + 15<<8 + 15<<4 + 15)
276 if maxR != basicMultilingualPlaneOffset {
277 t.Fatalf("max possible rune 0x%X != basicMultilingualPlaneOffset 0x%X", maxR, basicMultilingualPlaneOffset)
278 }
279 t.Logf("PROVEN: max rune from \\uXXXX = 0x%X = basicMultilingualPlaneOffset", maxR)
280}
281
282// =============================================================================
283// REMOVAL 4: `data[i] == '{'` block removed in EachKey

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected