26 lines
541 B
Go
26 lines
541 B
Go
package main
|
|
|
|
import (
|
|
"render231011/internal/thestore"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestOplog(t *testing.T) {
|
|
oplog := NewOplog()
|
|
oplog.push(time.Unix(1, 0), thestore.Event{ID: "1"})
|
|
oplog.push(time.Unix(2, 0), thestore.Event{ID: "2"})
|
|
oplog.push(time.Unix(3, 0), thestore.Event{ID: "3"})
|
|
oplog.push(time.Unix(4, 0), thestore.Event{ID: "4"})
|
|
|
|
got := oplog.Since(time.Unix(2, 0))
|
|
if len(got) != 2 {
|
|
t.Error(got)
|
|
} else if got[0].ID != "3" {
|
|
t.Error(got[0])
|
|
} else if got[1].ID != "4" {
|
|
t.Error(got[1])
|
|
}
|
|
t.Logf("%+v", got)
|
|
}
|