From a470aa89cbdabba813636b8a29be8ae3836c03a0 Mon Sep 17 00:00:00 2001 From: Marc Pervaz Boocha Date: Fri, 21 Feb 2025 18:24:35 +0530 Subject: Added LTR Eviction --- internal/pausedtimer/timer_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 internal/pausedtimer/timer_test.go (limited to 'internal/pausedtimer/timer_test.go') diff --git a/internal/pausedtimer/timer_test.go b/internal/pausedtimer/timer_test.go new file mode 100644 index 0000000..6e15001 --- /dev/null +++ b/internal/pausedtimer/timer_test.go @@ -0,0 +1,36 @@ +package pausedtimer + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestNew(t *testing.T) { + d := 1 * time.Second + timer := New(d) + assert.Equal(t, d, timer.duration) + assert.NotNil(t, timer.Ticker) +} + +func TestPauseTimerReset(t *testing.T) { + d := 1 * time.Second + timer := New(d) + newD := 2 * time.Second + timer.Reset(newD) + assert.Equal(t, newD, timer.duration) +} + +func TestPauseTimerResume(t *testing.T) { + d := 1 * time.Second + timer := NewStopped(d) + timer.Resume() + assert.Equal(t, d, timer.duration) +} + +func TestPauseTimerGetDuration(t *testing.T) { + d := 1 * time.Second + timer := New(d) + assert.Equal(t, d, timer.GetDuration()) +} -- cgit v1.2.3-70-g09d2