diff options
Diffstat (limited to 'utilities/utilities_test.go')
| -rw-r--r-- | utilities/utilities_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utilities/utilities_test.go b/utilities/utilities_test.go index aa66f6b..9cd4ef0 100644 --- a/utilities/utilities_test.go +++ b/utilities/utilities_test.go @@ -116,3 +116,13 @@ func TestWaitWithContext(t *testing.T) { wg.Wait() } + +func TestPerSecondToInterval(t *testing.T) { + if time.Second != PerSecondToInterval(1) { + t.Fatalf("A number of nanoseconds is not equal to a second!") + } + + if time.Second/2 != PerSecondToInterval(2) { + t.Fatalf("Something that happens twice per second should happen every 5000ns.") + } +} |
