Skip to content
Snippets Groups Projects
Commit 66615ca8 authored by Johannes Borgen's avatar Johannes Borgen
Browse files

added test for float input validation

parent e532d294
No related branches found
No related tags found
1 merge request!4Finished app
......@@ -28,6 +28,20 @@ func TestWeatherHandler(t *testing.T) {
handler.ServeHTTP(rr, req)
}
func TestGetFloat(t *testing.T) {
var test float64
test, err := GetFloat("3.1410230")
if err != nil || test != 3.1410230 {
t.Errorf("should not return error: %s", err)
}
test, err = GetFloat("bogus")
if err == nil && test != 0 {
t.Errorf("Error should be present, but got value: %f and error: %s", test, err)
}
}
func TestGetSingleForecast(t *testing.T) {
latitude := 58.8569687273594
longitude := 5.85660630854479
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment