MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestDistance

Function TestDistance

math/geometry/straightlines_test.go:7–15  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func TestDistance(t *testing.T) {
8 p1 := Point{0, 0}
9 p2 := Point{3, 4}
10 var wantedDistance float64 = 5
11 var calculatedDistance float64 = Distance(&p1, &p2)
12 if calculatedDistance != wantedDistance {
13 t.Fatalf("Failed to calculate Distance.")
14 }
15}
16
17func TestSection(t *testing.T) {
18 p1 := Point{1, 0}

Callers

nothing calls this directly

Calls 1

DistanceFunction · 0.70

Tested by

no test coverage detected