ketotrack/main_test.go

21 lines
305 B
Go
Raw Normal View History

2024-05-12 02:06:45 +00:00
package main
import (
"math"
"testing"
)
func TestGKI(t *testing.T) {
r := Reading{
Glucose: 77,
Ketone: 1.1,
}
expected := (77.0 / 18) / 1.1
epsilon := 0.0001 // Tolerance level
gki, _ := r.GKI()
if math.Abs(gki-expected) > epsilon {
t.Errorf("expected %v, got %v", expected, gki)
}
}