--------------------------------------------------------------------------- Property: ObjectEach visits every key-value pair exactly once --------------------------------------------------------------------------- reqproof:proptest ObjectEach Verifies: SYS-REQ-007 [property]
(t *testing.T)
| 363 | // reqproof:proptest ObjectEach |
| 364 | // Verifies: SYS-REQ-007 [property] |
| 365 | func TestPropertyObjectEachCompleteness(t *testing.T) { |
| 366 | r := newRNG(jsonSeed + 3) |
| 367 | const iterations = 1000 |
| 368 | for i := 0; i < iterations; i++ { |
| 369 | raw, obj := randomObjectJSONBytes(r, 1) |
| 370 | seen := map[string]bool{} |
| 371 | oerr := ObjectEach(raw, func(key, value []byte, dataType ValueType, offset int) error { |
| 372 | seen[string(key)] = true |
| 373 | return nil |
| 374 | }) |
| 375 | if oerr != nil { |
| 376 | t.Fatalf("ObjectEach errored on valid object %q: %v", raw, oerr) |
| 377 | } |
| 378 | for k := range obj { |
| 379 | if !seen[k] { |
| 380 | t.Fatalf("ObjectEach missed key %q on input %q (seen=%v)", k, raw, seen) |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | // --------------------------------------------------------------------------- |
| 387 | // Property: EachKey dispatches to matching paths without panic |
nothing calls this directly
no test coverage detected