Skip to content

Commit baab252

Browse files
committed
additional edge case unit test added
1 parent c950dd0 commit baab252

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gohex_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,4 +642,19 @@ func TestRemoveBinary(t *testing.T) {
642642
if len(m.GetDataSegments()) != 3 {
643643
t.Errorf("incorrect number of data segments: %v", len(m.GetDataSegments()))
644644
}
645+
646+
m.Clear()
647+
648+
m.AddBinary(0x00, []byte{0, 1})
649+
650+
m.RemoveBinary(0x02, 2)
651+
652+
data = m.ToBinary(0, 4, 0xFF)
653+
org = []byte{0, 1, 0xFF, 0xFF}
654+
if reflect.DeepEqual(data, org) == false {
655+
t.Errorf("incorrect binary data: %v", data)
656+
}
657+
if len(m.GetDataSegments()) != 1 {
658+
t.Errorf("incorrect number of data segments: %v", len(m.GetDataSegments()))
659+
}
645660
}

0 commit comments

Comments
 (0)