forked from makiuchi-d/gozxing
-
Notifications
You must be signed in to change notification settings - Fork 1
/
result_point_test.go
41 lines (34 loc) · 1.11 KB
/
result_point_test.go
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
30
31
32
33
34
35
36
37
38
39
40
41
package gozxing
import (
"testing"
)
func TestResultPoint_GetXY(t *testing.T) {
rp := NewResultPoint(0.5, 2.0)
if x := rp.GetX(); x != 0.5 {
t.Fatalf("GetX() = %v, expect %v", x, 0.5)
}
if y := rp.GetY(); y != 2.0 {
t.Fatalf("GetY() = %v, expect %v", y, 2.0)
}
}
func TestResultPoint_OrderBestPatterns(t *testing.T) {
a := NewResultPoint(1.5, -1)
b := NewResultPoint(1, 2)
c := NewResultPoint(-1, 1)
r0, r1, r2 := ResultPoint_OrderBestPatterns(a, b, c)
if r0 != a || r1 != b || r2 != c {
t.Fatalf("not best pattern [%v, %v, %v], expect [%v, %v, %v]", r0, r1, r2, a, b, c)
}
r0, r1, r2 = ResultPoint_OrderBestPatterns(c, b, a)
if r0 != a || r1 != b || r2 != c {
t.Fatalf("not best pattern [%v, %v, %v], expect [%v, %v, %v]", r0, r1, r2, a, b, c)
}
r0, r1, r2 = ResultPoint_OrderBestPatterns(b, c, a)
if r0 != a || r1 != b || r2 != c {
t.Fatalf("not best pattern [%v, %v, %v], expect [%v, %v, %v]", r0, r1, r2, a, b, c)
}
r0, r1, r2 = ResultPoint_OrderBestPatterns(c, a, b)
if r0 != a || r1 != b || r2 != c {
t.Fatalf("not best pattern [%v, %v, %v], expect [%v, %v, %v]", r0, r1, r2, a, b, c)
}
}