Skip to content

Commit

Permalink
Merge pull request #39 from umpc/dev
Browse files Browse the repository at this point in the history
Remove iter testing debug code from delete tests. Addressed lint warning. gofmt.
  • Loading branch information
umpc authored Jul 6, 2017
2 parents a8080c6 + d0b271f commit 11ab76c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 65 deletions.
52 changes: 0 additions & 52 deletions delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,67 +85,15 @@ func TestBoundedDelete(t *testing.T) {
t.Fatal(err)
}

func() {
iterCh, err := sm.IterCh()
if err != nil {

} else {
defer iterCh.Close()

if err := verifyRecords(iterCh.Records(), false); err != nil {
t.Fatal(err)
}
}
}()

if err := sm.BoundedDelete(earlierDate, time.Now()); err != nil {
t.Fatal(err)
}

func() {
iterCh, err := sm.IterCh()
if err != nil {

} else {
defer iterCh.Close()

if err := verifyRecords(iterCh.Records(), false); err != nil {
t.Fatal(err)
}
}
}()

if err := sm.BoundedDelete(time.Now(), earlierDate); err == nil {
t.Fatal(shouldFailErr)
}

func() {
iterCh, err := sm.IterCh()
if err != nil {

} else {
defer iterCh.Close()

if err := verifyRecords(iterCh.Records(), false); err != nil {
t.Fatal(err)
}
}
}()

if err := sm.BoundedDelete(earlierDate, earlierDate); err == nil {
t.Fatal(shouldFailErr)
}

func() {
iterCh, err := sm.IterCh()
if err != nil {

} else {
defer iterCh.Close()

if err := verifyRecords(iterCh.Records(), false); err != nil {
t.Fatal(err)
}
}
}()
}
2 changes: 1 addition & 1 deletion iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (sm *SortedMap) sendRecord(iterCh IterChCloser, sendTimeout time.Duration,

case iterCh.ch <- sm.recordFromIdx(i):
return true
}
}
}

select {
Expand Down
18 changes: 9 additions & 9 deletions iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ func TestBoundedIterCh(t *testing.T) {
func TestBounds(t *testing.T) {
sm := New(4, asc.Time)

obsd := time.Date(1995, 10, 18, 8, 37, 1, 0, time.UTC)
unixtime := time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
linux := time.Date(1991, 8, 25, 20, 57, 8, 0, time.UTC)
github := time.Date(2008, 4, 10, 0, 0, 0, 0, time.UTC)
obsd := time.Date(1995, 10, 18, 8, 37, 1, 0, time.UTC)
unixtime := time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
linux := time.Date(1991, 8, 25, 20, 57, 8, 0, time.UTC)
github := time.Date(2008, 4, 10, 0, 0, 0, 0, time.UTC)

sm.Insert("OpenBSD", obsd)
sm.Insert("OpenBSD", obsd)
sm.Insert("UnixTime", unixtime)
sm.Insert("Linux", linux)
sm.Insert("GitHub", github)
sm.Insert("Linux", linux)
sm.Insert("GitHub", github)

reversed := false

Expand Down Expand Up @@ -338,8 +338,8 @@ func TestCloseCustomIterCh(t *testing.T) {

params := IterChParams{
SendTimeout: 5 * time.Minute,
LowerBound: earlierDate,
UpperBound: laterDate,
LowerBound: earlierDate,
UpperBound: laterDate,
}

ch, err = sm.CustomIterCh(params)
Expand Down
6 changes: 3 additions & 3 deletions testing_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ func newSortedMapFromRandRecords(n int) (*SortedMap, []Record, error) {
iterCh, err := sm.IterCh()
if err != nil {
return sm, records, err
} else {
defer iterCh.Close()
return sm, records, verifyRecords(iterCh.Records(), false)
}
defer iterCh.Close()

return sm, records, verifyRecords(iterCh.Records(), false)
}

func newRandSortedMapWithKeys(n int) (*SortedMap, []Record, []interface{}, error) {
Expand Down

0 comments on commit 11ab76c

Please sign in to comment.