package lock_free import ( "testing" "time" ) func TestDelayLkQueue(t *testing.T) { cases := []struct { value int duration time.Duration }{ {1, time.Second}, {3, time.Second * 3}, } q := NewDelayLkQueue[int]() for _, c := range cases { q.DelayEnqueue(c.value, c.duration) } notify := make(chan int) go func() { for data := range notify { t.Log(data) t.Log(time.Now().Unix()) } }() go q.ContinuousDequeueNotify(notify) time.Sleep(time.Second * 5) close(notify) }