diff --git a/internal/config/envconfig_test.go b/internal/config/envconfig_test.go index abeaea0..c6c74a4 100644 --- a/internal/config/envconfig_test.go +++ b/internal/config/envconfig_test.go @@ -1,6 +1,7 @@ package config import ( + "math" "strconv" "testing" ) @@ -184,19 +185,23 @@ func TestTypeConversion(t *testing.T) { t.Fatalf("Expected: %d, got: %d", 100, output_uint64) } - /* // float32 output_float32, _ := typeConversion("float32", "100.001") - if float32(output_float32.(float64)) != float32(100.1) { - t.Fatalf("Expected: %f, got: %f", 100.1, output_float32) + if float32(math.Round(output_float32.(float64)*1000)/1000) != float32(math.Round(100.001*1000)/1000) { + t.Fatalf("Expected: %f, got: %f", float32(math.Round(100.001*1000)/1000), float32(math.Round(output_float32.(float64)*1000)/1000)) } // float64 output_float64, _ := typeConversion("float64", "100.001") - if output_float64.(float64) != 100.001 { - t.Fatalf("Expected: %f, got: %f", 100.001, output_float64) + if math.Round(output_float64.(float64)*1000)/1000 != math.Round(100.001*1000)/1000 { + t.Fatalf("Expected: %f, got: %f", math.Round(100.001*1000)/1000, math.Round(output_float64.(float64)*1000)/1000) + } + + // bool + output_bool, _ := typeConversion("bool", "true") + if output_bool.(bool) != true { + t.Fatalf("Expected: %t, got: %t", true, output_bool.(bool)) } - */ } func TestParseFlags(t *testing.T) {