checkParseBooleanGate (Gate 9: PARSEBOOLEAN) cross-checks ParseBoolean against strconv.ParseBool on Boolean-typed values. Closes the API-coverage blind spot: the structure-aware fuzzer cross-checks ParseInt/ParseFloat (via checkNumericOracle) but NEVER reaches ParseBoolean.
(t *testing.T, data []byte, path []string)
| 1209 | // blind spot: the structure-aware fuzzer cross-checks ParseInt/ParseFloat |
| 1210 | // (via checkNumericOracle) but NEVER reaches ParseBoolean. |
| 1211 | func checkParseBooleanGate(t *testing.T, data []byte, path []string) { |
| 1212 | t.Helper() |
| 1213 | val, dt, _, err := Get(data, path...) |
| 1214 | if err != nil || dt != Boolean || len(val) == 0 { |
| 1215 | return |
| 1216 | } |
| 1217 | jpVal, jpErr := ParseBoolean(val) |
| 1218 | sVal, sErr := strconv.ParseBool(string(val)) |
| 1219 | if (jpErr == nil) != (sErr == nil) { |
| 1220 | t.Errorf("ParseBoolean disagreement on %q (PARSEBOOLEAN differential): "+ |
| 1221 | "jsonparser=(%v,%v) strconv=(%v,%v) data=%q path=%v", |
| 1222 | val, jpVal, jpErr, sVal, sErr, data, path) |
| 1223 | } else if jpErr == nil && jpVal != sVal { |
| 1224 | t.Errorf("ParseBoolean value mismatch on %q: "+ |
| 1225 | "jsonparser=%v strconv=%v data=%q path=%v", |
| 1226 | val, jpVal, sVal, data, path) |
| 1227 | } |
| 1228 | } |
| 1229 | |
| 1230 | // ============================================================================= |
| 1231 | // Gate runner (the assertions that catch each bug class) |
no test coverage detected