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

Function TestSlope

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

Source from the content-addressed store, hash-verified

25}
26
27func TestSlope(t *testing.T) {
28 line := Line{P1: Point{1, 2}, P2: Point{2, 4}}
29 var wantedSlope float64 = 2
30 var calculatedSlope float64 = Slope(&line)
31 if calculatedSlope != wantedSlope {
32 t.Fatalf("Failed to calculate Slope.")
33 }
34}
35
36func TestIntercept(t *testing.T) {
37 p := Point{0, 3}

Callers

nothing calls this directly

Calls 1

SlopeFunction · 0.85

Tested by

no test coverage detected