// Test intersecting sets of SeriesIDs. func Test_SeriesIDs_Intersect(t *testing.T) { // Test swaping l & r, all branches of if-else, and exit loop when 'j < len(r)' ids1 := tsdb.SeriesIDs{1, 3, 4, 5, 6} ids2 := tsdb.SeriesIDs{1, 2, 3, 7} exp := tsdb.SeriesIDs{1, 3} got := ids1.Intersect(ids2) if !exp.Equals(got) { t.Fatalf("exp=%v, got=%v", exp, got) } // Test exit for loop when 'i < len(l)' ids1 = tsdb.SeriesIDs{1} ids2 = tsdb.SeriesIDs{1, 2} exp = tsdb.SeriesIDs{1} got = ids1.Intersect(ids2) if !exp.Equals(got) { t.Fatalf("exp=%v, got=%v", exp, got) } }