enhance TestRunCountRange

confirm that the number of runs comes out as expected,
and add a couple of numbers out of order to verify that
the 17-18-19 set gets coalesced into one run even
if we add 17 and 19 before 18.
This commit is contained in:
Seebs 2018-11-13 12:21:47 -06:00
parent d4364bea52
commit 9b552ab508

View file

@ -165,8 +165,8 @@ func TestRunCountRange(t *testing.T) {
}
c.add(17)
c.add(18)
c.add(19)
c.add(18)
cnt = c.runCountRange(1, 22)
if cnt != 10 {
@ -180,6 +180,11 @@ func TestRunCountRange(t *testing.T) {
if cnt != 9 {
t.Fatalf("should get 9 from multiple ranges overlapping both sides, but got: %v", cnt)
}
// verify that the disparate ops resulted in three separate runs
cnt = c.countRuns()
if cnt != 3 {
t.Fatalf("should get 3 total runs, but got: %v [%v]", cnt, c.runs)
}
}
func TestRunContains(t *testing.T) {