Added unit tests

This commit is contained in:
2025-06-20 09:47:04 +02:00
parent 0f487e3f93
commit a987c0fb34
5 changed files with 182 additions and 1 deletions

28
model/windModel_test.go Normal file
View File

@@ -0,0 +1,28 @@
package model
import (
"testing"
)
type TestEntry struct {
Name string
Input float64
Expected string
}
func TestGetCardinalDir(t *testing.T) {
tests := []TestEntry{
{"Bounded value", 65.4, "ENE"},
{"Out of bound value", 450.3, "E"},
}
for _, test := range tests {
t.Run(test.Name, func(t *testing.T) {
got, _ := GetCardinalDir(test.Input)
if got != test.Expected {
t.Errorf("Got %s, wanted %s", got, test.Expected)
}
})
}
}