-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint_test.go
More file actions
29 lines (24 loc) · 614 Bytes
/
point_test.go
File metadata and controls
29 lines (24 loc) · 614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-FileCopyrightText: 2018 Raph Levien
// SPDX-FileCopyrightText: 2024 Dominik Honnef and contributors
//
// SPDX-License-Identifier: MIT
// SPDX-FileAttributionText: https://github.com/linebender/kurbo
package curve
import (
"testing"
)
func TestPointArithmetic(t *testing.T) {
diff(t, Pt(0, 0).Translate(Vec(-10, 0)), Pt(-10, 0))
}
func TestPointDistance(t *testing.T) {
p1 := Pt(0, 10)
p2 := Pt(0, 5)
if d := p1.Distance(p2); d != 5 {
t.Errorf("got distance %v, want 5", d)
}
p3 := Pt(-11, 1)
p4 := Pt(-7, -2)
if d := p3.Distance(p4); d != 5 {
t.Errorf("got distance %v, want 5", d)
}
}