Verifies: SYS-REQ-006 [example] MCDC SYS-REQ-006: addressed_array_is_empty=F, addressed_array_is_well_formed=T, array_callback_receives_elements_in_order=F => FALSE MCDC SYS-REQ-006: addressed_array_is_empty=F, addressed_array_is_well_formed=T, array_callback_receives_elements_in_order=T => TRUE
(t *testing.T)
| 1607 | // MCDC SYS-REQ-006: addressed_array_is_empty=F, addressed_array_is_well_formed=T, array_callback_receives_elements_in_order=F => FALSE |
| 1608 | // MCDC SYS-REQ-006: addressed_array_is_empty=F, addressed_array_is_well_formed=T, array_callback_receives_elements_in_order=T => TRUE |
| 1609 | func TestArrayEach(t *testing.T) { |
| 1610 | mock := []byte(`{"a": { "b":[{"x": 1} ,{"x":2},{ "x":3}, {"x":4} ]}}`) |
| 1611 | count := 0 |
| 1612 | |
| 1613 | ArrayEach(mock, func(value []byte, dataType ValueType, offset int, err error) { |
| 1614 | count++ |
| 1615 | |
| 1616 | switch count { |
| 1617 | case 1: |
| 1618 | if string(value) != `{"x": 1}` { |
| 1619 | t.Errorf("Wrong first item: %s", string(value)) |
| 1620 | } |
| 1621 | case 2: |
| 1622 | if string(value) != `{"x":2}` { |
| 1623 | t.Errorf("Wrong second item: %s", string(value)) |
| 1624 | } |
| 1625 | case 3: |
| 1626 | if string(value) != `{ "x":3}` { |
| 1627 | t.Errorf("Wrong third item: %s", string(value)) |
| 1628 | } |
| 1629 | case 4: |
| 1630 | if string(value) != `{"x":4}` { |
| 1631 | t.Errorf("Wrong forth item: %s", string(value)) |
| 1632 | } |
| 1633 | default: |
| 1634 | t.Errorf("Should process only 4 items") |
| 1635 | } |
| 1636 | }, "a", "b") |
| 1637 | } |
| 1638 | |
| 1639 | // Verifies: SYS-REQ-029 [boundary] |
| 1640 | // MCDC SYS-REQ-029: addressed_array_is_well_formed=F, malformed_array_input_returns_error=T => TRUE |
nothing calls this directly
no test coverage detected
searching dependent graphs…