--------------------------------------------------------------------------- Property: internalGet agrees with Get (Get is a thin projection) --------------------------------------------------------------------------- reqproof:proptest internalGet Verifies: SYS-REQ-001 [property]
(t *testing.T)
| 707 | // reqproof:proptest internalGet |
| 708 | // Verifies: SYS-REQ-001 [property] |
| 709 | func TestPropertyInternalGetConsistentWithGet(t *testing.T) { |
| 710 | r := newRNG(jsonSeed + 12) |
| 711 | const iterations = 1000 |
| 712 | for i := 0; i < iterations; i++ { |
| 713 | raw := randomJSONBytes(r, 2) |
| 714 | keys := []string{randKey(r)} |
| 715 | // Get is `a, b, _, d, e := internalGet(...); return a, b, d, e` — i.e. |
| 716 | // Get's offset is internalGet's END offset, not its start offset. |
| 717 | // So we compare value, type, and error; offsets are related but |
| 718 | // not identical fields. |
| 719 | v1, t1, _, e1 := Get(raw, keys...) |
| 720 | v2, t2, _, _, e2 := internalGet(raw, keys...) |
| 721 | if !bytes.Equal(v1, v2) || t1 != t2 || (e1 == nil) != (e2 == nil) { |
| 722 | t.Fatalf("internalGet/Get disagree on input %q keys=%v: Get=(%q,%v,err=%v) iGet=(%q,%v,err=%v)", |
| 723 | raw, keys, v1, t1, e1, v2, t2, e2) |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | // --------------------------------------------------------------------------- |
| 729 | // Property: WriteToBuffer / calcAllocateSpace / createInsertComponent are pure |
nothing calls this directly
no test coverage detected