--------------------------------------------------------------------------- Property: ObjectEach visits every key-value pair exactly once --------------------------------------------------------------------------- reqproof:proptest parser.ObjectEach Verifies: SYS-REQ-007 [property]
(t *testing.T)
| 378 | // reqproof:proptest parser.ObjectEach |
| 379 | // Verifies: SYS-REQ-007 [property] |
| 380 | func TestPropertyObjectEachCompleteness(t *testing.T) { |
| 381 | r := newRNG(jsonSeed + 3) |
| 382 | const iterations = 1000 |
| 383 | for i := 0; i < iterations; i++ { |
| 384 | raw, obj := randomObjectJSONBytes(r, 1) |
| 385 | seen := map[string]bool{} |
| 386 | oerr := ObjectEach(raw, func(key, value []byte, dataType ValueType, offset int) error { |
| 387 | seen[string(key)] = true |
| 388 | return nil |
| 389 | }) |
| 390 | if oerr != nil { |
| 391 | t.Fatalf("ObjectEach errored on valid object %q: %v", raw, oerr) |
| 392 | } |
| 393 | for k := range obj { |
| 394 | if !seen[k] { |
| 395 | t.Fatalf("ObjectEach missed key %q on input %q (seen=%v)", k, raw, seen) |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | // --------------------------------------------------------------------------- |
| 402 | // Property: EachKey dispatches to matching paths without panic |
nothing calls this directly
no test coverage detected