1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-21 06:18:25 +02:00

Code review (round 1)

This commit is contained in:
binwiederhier 2023-02-08 22:57:10 -05:00
parent 7706bd9845
commit b37cf02a6e
12 changed files with 78 additions and 23 deletions

View file

@ -2,6 +2,7 @@ package util
import (
"errors"
"golang.org/x/time/rate"
"io"
"net/netip"
"os"
@ -245,6 +246,12 @@ func TestMinMax(t *testing.T) {
require.Equal(t, 50, MinMax(50, 10, 99))
}
func TestMax(t *testing.T) {
require.Equal(t, 9, Max(1, 9))
require.Equal(t, 9, Max(9, 1))
require.Equal(t, rate.Every(time.Minute), Max(rate.Every(time.Hour), rate.Every(time.Minute)))
}
func TestPointerFunctions(t *testing.T) {
i, s, ti := Int(99), String("abc"), Time(time.Unix(99, 0))
require.Equal(t, 99, *i)