Skip to content

Commit

Permalink
Add unittest for Timestamp method (segmentio#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nghialt authored and Achille committed Jun 23, 2019
1 parent 7d859c5 commit 9349bd0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ksuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ func TestPrevNext(t *testing.T) {
}
}

func TestGetTimestamp(t *testing.T) {
nowTime := time.Now()
x, _ := NewRandomWithTime(nowTime)
xTime := int64(x.Timestamp())
unix := nowTime.Unix()
if xTime != unix - epochStamp {
t.Fatal(xTime, "!=", unix)
}
}

func testPrevNext(t *testing.T, id, prev, next KSUID) {
id1 := id.Prev()
id2 := id.Next()
Expand Down

0 comments on commit 9349bd0

Please sign in to comment.