--------------------------------------------------------------------------- Property: Delete is idempotent (Delete twice == Delete once) --------------------------------------------------------------------------- reqproof:proptest Delete Verifies: SYS-REQ-034 [property]
(t *testing.T)
| 452 | // reqproof:proptest Delete |
| 453 | // Verifies: SYS-REQ-034 [property] |
| 454 | func TestPropertyDeleteIdempotent(t *testing.T) { |
| 455 | r := newRNG(jsonSeed + 6) |
| 456 | const iterations = 500 |
| 457 | for i := 0; i < iterations; i++ { |
| 458 | raw, obj := randomObjectJSONBytes(r, 1) |
| 459 | var key string |
| 460 | for k := range obj { |
| 461 | key = k |
| 462 | break |
| 463 | } |
| 464 | if key == "" { |
| 465 | continue |
| 466 | } |
| 467 | once := Delete(raw, key) |
| 468 | twice := Delete(once, key) |
| 469 | if !bytes.Equal(once, twice) { |
| 470 | t.Fatalf("Delete not idempotent on input %q key=%q: once=%q twice=%q", raw, key, once, twice) |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | // --------------------------------------------------------------------------- |
| 476 | // Property: searchKeys is deterministic and bounded on arbitrary bytes |
nothing calls this directly
no test coverage detected