RezinaLMS-BackEnd/internal/repository/store_config_test.go

21 lines
491 B
Go

package repository
import "testing"
func TestEnvInt32(t *testing.T) {
for _, tc := range []struct {
value string
want int32
}{
{"", 25}, {"invalid", 25}, {"0", 25}, {"-1", 25}, {"2147483648", 25},
{"4294967321", 25}, {"2147483647", 2147483647}, {"50", 50},
} {
t.Run(tc.value, func(t *testing.T) {
t.Setenv("REZINA_TEST_POOL_SIZE", tc.value)
if got := envInt32("REZINA_TEST_POOL_SIZE", 25); got != tc.want {
t.Errorf("got %d, want %d", got, tc.want)
}
})
}
}