Added a /conditions/current endpoint with computed best-guess values for current conditions
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
@@ -41,3 +41,32 @@ func TestUSConverterSpeedKmhToOutput(t *testing.T) {
|
||||
t.Fatalf("expected 10.0 mph, got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetricConverterPassthrough(t *testing.T) {
|
||||
c := MetricConverter{}
|
||||
|
||||
if got := c.TemperatureCToOutput(nil); got != nil {
|
||||
t.Fatalf("expected nil for nil temperature input")
|
||||
}
|
||||
if got := c.SpeedKmhToOutput(nil); got != nil {
|
||||
t.Fatalf("expected nil for nil speed input")
|
||||
}
|
||||
|
||||
temp := 12.3456
|
||||
gotTemp := c.TemperatureCToOutput(&temp)
|
||||
if gotTemp == nil || *gotTemp != temp {
|
||||
t.Fatalf("expected temperature passthrough %v, got %v", temp, gotTemp)
|
||||
}
|
||||
if gotTemp == &temp {
|
||||
t.Fatalf("expected temperature output to be a clone pointer")
|
||||
}
|
||||
|
||||
speed := 14.2
|
||||
gotSpeed := c.SpeedKmhToOutput(&speed)
|
||||
if gotSpeed == nil || *gotSpeed != speed {
|
||||
t.Fatalf("expected speed passthrough %v, got %v", speed, gotSpeed)
|
||||
}
|
||||
if gotSpeed == &speed {
|
||||
t.Fatalf("expected speed output to be a clone pointer")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user