@@ -12,54 +12,54 @@ import (
12
12
13
13
func BenchmarkPosition_Add (b * testing.B ) {
14
14
b .Run ("Add()" , benchmarkPositionAdd )
15
- b .Run ("AddXAndY ()" , benchmarkPositionAddXAndY )
15
+ b .Run ("AddXY ()" , benchmarkPositionAddXY )
16
16
}
17
17
18
18
func BenchmarkPosition_Subtract (b * testing.B ) {
19
19
b .Run ("Subtract()" , benchmarkPositionSubtract )
20
- b .Run ("SubtractXAndY ()" , benchmarkPositionSubtractXAndY )
20
+ b .Run ("SubtractXY ()" , benchmarkPositionSubtractXY )
21
21
}
22
22
23
23
func BenchmarkSize_Add (b * testing.B ) {
24
24
b .Run ("Add()" , benchmarkSizeAdd )
25
- b .Run ("AddWidthAndHeight ()" , benchmarkSizeAddWidthAndHeight )
25
+ b .Run ("AddWidthHeight ()" , benchmarkSizeAddWidthHeight )
26
26
}
27
27
28
28
func BenchmarkSize_Subtract (b * testing.B ) {
29
29
b .Run ("Subtract()" , benchmarkSizeSubtract )
30
- b .Run ("SubtractWidthAndHeight ()" , benchmarkSizeSubtractWidthAndHeight )
30
+ b .Run ("SubtractWidthHeight ()" , benchmarkSizeSubtractWidthHeight )
31
31
}
32
32
33
- // This test prevents Position.Add to be simplified to `return p.AddXAndY (v.Components())`
33
+ // This test prevents Position.Add to be simplified to `return p.AddXY (v.Components())`
34
34
// because this slows down the speed by factor 10.
35
35
func TestPosition_Add_Speed (t * testing.T ) {
36
36
add := testing .Benchmark (benchmarkPositionAdd )
37
- addXAndY := testing .Benchmark (benchmarkPositionAddXAndY )
38
- assert .Less (t , add .NsPerOp ()/ addXAndY .NsPerOp (), int64 (5 ))
37
+ addXY := testing .Benchmark (benchmarkPositionAddXY )
38
+ assert .Less (t , add .NsPerOp ()/ addXY .NsPerOp (), int64 (5 ))
39
39
}
40
40
41
- // This test prevents Position.Subtract to be simplified to `return p.SubtractXAndY (v.Components())`
41
+ // This test prevents Position.Subtract to be simplified to `return p.SubtractXY (v.Components())`
42
42
// because this slows down the speed by factor 10.
43
43
func TestPosition_Subtract_Speed (t * testing.T ) {
44
44
subtract := testing .Benchmark (benchmarkPositionSubtract )
45
- subtractXAndY := testing .Benchmark (benchmarkPositionSubtractXAndY )
46
- assert .Less (t , subtract .NsPerOp ()/ subtractXAndY .NsPerOp (), int64 (5 ))
45
+ subtractXY := testing .Benchmark (benchmarkPositionSubtractXY )
46
+ assert .Less (t , subtract .NsPerOp ()/ subtractXY .NsPerOp (), int64 (5 ))
47
47
}
48
48
49
- // This test prevents Size.Add to be simplified to `return s.AddWidthAndHeight (v.Components())`
49
+ // This test prevents Size.Add to be simplified to `return s.AddWidthHeight (v.Components())`
50
50
// because this slows down the speed by factor 10.
51
51
func TestSize_Add_Speed (t * testing.T ) {
52
52
add := testing .Benchmark (benchmarkSizeAdd )
53
- addWidthAndHeight := testing .Benchmark (benchmarkSizeAddWidthAndHeight )
54
- assert .Less (t , add .NsPerOp ()/ addWidthAndHeight .NsPerOp (), int64 (5 ))
53
+ addWidthHeight := testing .Benchmark (benchmarkSizeAddWidthHeight )
54
+ assert .Less (t , add .NsPerOp ()/ addWidthHeight .NsPerOp (), int64 (5 ))
55
55
}
56
56
57
- // This test prevents Size.Subtract to be simplified to `return s.SubtractWidthAndHeight (v.Components())`
57
+ // This test prevents Size.Subtract to be simplified to `return s.SubtractWidthHeight (v.Components())`
58
58
// because this slows down the speed by factor 10.
59
59
func TestSize_Subtract_Speed (t * testing.T ) {
60
60
subtract := testing .Benchmark (benchmarkSizeSubtract )
61
- subtractWidthAndHeight := testing .Benchmark (benchmarkSizeSubtractWidthAndHeight )
62
- assert .Less (t , subtract .NsPerOp ()/ subtractWidthAndHeight .NsPerOp (), int64 (5 ))
61
+ subtractWidthHeight := testing .Benchmark (benchmarkSizeSubtractWidthHeight )
62
+ assert .Less (t , subtract .NsPerOp ()/ subtractWidthHeight .NsPerOp (), int64 (5 ))
63
63
}
64
64
65
65
var benchmarkResult interface {}
@@ -72,10 +72,10 @@ func benchmarkPositionAdd(b *testing.B) {
72
72
benchmarkResult = pos
73
73
}
74
74
75
- func benchmarkPositionAddXAndY (b * testing.B ) {
75
+ func benchmarkPositionAddXY (b * testing.B ) {
76
76
pos := fyne .NewPos (10 , 10 )
77
77
for n := 0 ; n < b .N ; n ++ {
78
- pos = pos .AddXAndY (float32 (n ), float32 (n ))
78
+ pos = pos .AddXY (float32 (n ), float32 (n ))
79
79
}
80
80
benchmarkResult = pos
81
81
}
@@ -88,10 +88,10 @@ func benchmarkPositionSubtract(b *testing.B) {
88
88
benchmarkResult = pos
89
89
}
90
90
91
- func benchmarkPositionSubtractXAndY (b * testing.B ) {
91
+ func benchmarkPositionSubtractXY (b * testing.B ) {
92
92
pos := fyne .NewPos (10 , 10 )
93
93
for n := 0 ; n < b .N ; n ++ {
94
- pos = pos .SubtractXAndY (float32 (n ), float32 (n ))
94
+ pos = pos .SubtractXY (float32 (n ), float32 (n ))
95
95
}
96
96
benchmarkResult = pos
97
97
}
@@ -104,10 +104,10 @@ func benchmarkSizeAdd(b *testing.B) {
104
104
benchmarkResult = size
105
105
}
106
106
107
- func benchmarkSizeAddWidthAndHeight (b * testing.B ) {
107
+ func benchmarkSizeAddWidthHeight (b * testing.B ) {
108
108
size := fyne .NewSize (10 , 10 )
109
109
for n := 0 ; n < b .N ; n ++ {
110
- size = size .AddWidthAndHeight (float32 (n ), float32 (n ))
110
+ size = size .AddWidthHeight (float32 (n ), float32 (n ))
111
111
}
112
112
benchmarkResult = size
113
113
}
@@ -120,10 +120,10 @@ func benchmarkSizeSubtract(b *testing.B) {
120
120
benchmarkResult = size
121
121
}
122
122
123
- func benchmarkSizeSubtractWidthAndHeight (b * testing.B ) {
123
+ func benchmarkSizeSubtractWidthHeight (b * testing.B ) {
124
124
size := fyne .NewSize (10 , 10 )
125
125
for n := 0 ; n < b .N ; n ++ {
126
- size = size .SubtractWidthAndHeight (float32 (n ), float32 (n ))
126
+ size = size .SubtractWidthHeight (float32 (n ), float32 (n ))
127
127
}
128
128
benchmarkResult = size
129
129
}
0 commit comments