Verifies: SYS-REQ-100 MCDC SYS-REQ-100: set_applied_twice_with_same_args=T, set_second_call_produces_same_result=T => TRUE
(t *testing.T)
| 250 | // Verifies: SYS-REQ-100 |
| 251 | // MCDC SYS-REQ-100: set_applied_twice_with_same_args=T, set_second_call_produces_same_result=T => TRUE |
| 252 | func TestSetIdempotency(t *testing.T) { |
| 253 | data := []byte(`{"name":"alice","age":30}`) |
| 254 | setValue := []byte(`"bob"`) |
| 255 | |
| 256 | // First Set application |
| 257 | result1, err1 := Set(data, setValue, "name") |
| 258 | if err1 != nil { |
| 259 | t.Fatalf("First Set returned error: %v", err1) |
| 260 | } |
| 261 | |
| 262 | // Second Set application on the result of the first |
| 263 | result2, err2 := Set(result1, setValue, "name") |
| 264 | if err2 != nil { |
| 265 | t.Fatalf("Second Set returned error: %v", err2) |
| 266 | } |
| 267 | |
| 268 | // The results should be identical -- setting the same key to the same value twice |
| 269 | if !bytes.Equal(result1, result2) { |
| 270 | t.Fatalf("Set not idempotent: first %q, second %q", result1, result2) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | // ============================================================================= |
| 275 | // Nil safety tests |
nothing calls this directly
no test coverage detected
searching dependent graphs…