diff --git a/bitset_test.go b/bitset_test.go index 0dfd11a..d0bee7f 100644 --- a/bitset_test.go +++ b/bitset_test.go @@ -2117,6 +2117,23 @@ func TestPreviousSet(t *testing.T) { } }) } + v.ClearAll() + for _, tt := range []struct { + index uint + want uint + wantFound bool + }{ + {0, 0, false}, + {120, 0, false}, + {1024, 0, false}, + } { + t.Run(fmt.Sprintf("@%d", tt.index), func(t *testing.T) { + got, found := v.PreviousSet(tt.index) + if got != tt.want || found != tt.wantFound { + t.Errorf("PreviousSet(%d) = %d, %v, want %d, %v", tt.index, got, found, tt.want, tt.wantFound) + } + }) + } } func TestPreviousClear(t *testing.T) { @@ -2148,4 +2165,21 @@ func TestPreviousClear(t *testing.T) { } }) } + v.SetAll() + for _, tt := range []struct { + index uint + want uint + wantFound bool + }{ + {0, 0, false}, + {120, 0, false}, + {1024, 0, false}, + } { + t.Run(fmt.Sprintf("@%d", tt.index), func(t *testing.T) { + got, found := v.PreviousClear(tt.index) + if got != tt.want || found != tt.wantFound { + t.Errorf("PreviousClear(%d) = %d, %v, want %d, %v", tt.index, got, found, tt.want, tt.wantFound) + } + }) + } }