35f5084005
git-subtree-dir: backend git-subtree-mainline:dc11190527git-subtree-split:acae976622
19 lines
529 B
Go
19 lines
529 B
Go
package utils
|
|
|
|
import "testing"
|
|
|
|
func TestHaversineKM_SamePoint(t *testing.T) {
|
|
d := HaversineKM(35.6892, 51.3890, 35.6892, 51.3890)
|
|
if d > 0.001 {
|
|
t.Fatalf("expected ~0km for identical points, got %v", d)
|
|
}
|
|
}
|
|
|
|
func TestHaversineKM_TehranToIsfahan(t *testing.T) {
|
|
// فاصلهی تهران تا اصفهان تقریباً ۳۴۰ کیلومتره (خط مستقیم)
|
|
d := HaversineKM(35.6892, 51.3890, 32.6546, 51.6680)
|
|
if d < 300 || d > 380 {
|
|
t.Fatalf("expected ~340km between Tehran and Isfahan, got %v", d)
|
|
}
|
|
}
|