Verifies: SYS-REQ-113 (wildcard path support) reqproof:proptest:skip targeted witness/regression test; not a property-test subject SYS-REQ-113:nominal:nominal
(t *testing.T)
| 113 | // reqproof:proptest:skip targeted witness/regression test; not a property-test subject |
| 114 | // SYS-REQ-113:nominal:nominal |
| 115 | func TestArrayEachWildcard(t *testing.T) { |
| 116 | data := []byte(`{"values":[10,20,30]}`) |
| 117 | var indices []int |
| 118 | var values []string |
| 119 | var offsets []int |
| 120 | |
| 121 | count, err := ArrayEachWildcard(data, func(idx int, value []byte, _ ValueType, offset int, err error) error { |
| 122 | if err != nil { |
| 123 | return err |
| 124 | } |
| 125 | indices = append(indices, idx) |
| 126 | values = append(values, string(value)) |
| 127 | offsets = append(offsets, offset) |
| 128 | return nil |
| 129 | }, "values", "[*]") |
| 130 | |
| 131 | if err != nil { |
| 132 | t.Fatalf("ArrayEachWildcard() error = %v, want nil", err) |
| 133 | } |
| 134 | if count != 3 { |
| 135 | t.Fatalf("ArrayEachWildcard() count = %d, want 3", count) |
| 136 | } |
| 137 | if want := []int{0, 1, 2}; !reflect.DeepEqual(indices, want) { |
| 138 | t.Fatalf("indices = %v, want %v", indices, want) |
| 139 | } |
| 140 | if want := []string{"10", "20", "30"}; !reflect.DeepEqual(values, want) { |
| 141 | t.Fatalf("values = %q, want %q", values, want) |
| 142 | } |
| 143 | if !(offsets[0] < offsets[1] && offsets[1] < offsets[2]) { |
| 144 | t.Fatalf("offsets = %v, want strictly increasing offsets", offsets) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // Verifies: SYS-REQ-113 (wildcard path support) |
| 149 | // reqproof:proptest:skip targeted witness/regression test; not a property-test subject |
nothing calls this directly
no test coverage detected