@@ -108,14 +108,16 @@ func TestProduct(t *testing.T) {
108
108
result5 := Product ([]uint32 {2 , 3 , 4 , 5 })
109
109
result6 := Product ([]uint32 {})
110
110
result7 := Product ([]complex128 {4_4 , 2_2 })
111
+ result8 := Product [uint32 ](nil )
111
112
112
113
is .Equal (result1 , float32 (160.908 ))
113
114
is .Equal (result2 , int32 (120 ))
114
115
is .Equal (result3 , int32 (0 ))
115
116
is .Equal (result4 , int32 (- 126 ))
116
117
is .Equal (result5 , uint32 (120 ))
117
- is .Equal (result6 , uint32 (0 ))
118
+ is .Equal (result6 , uint32 (1 ))
118
119
is .Equal (result7 , complex128 (96_8 ))
120
+ is .Equal (result8 , uint32 (1 ))
119
121
}
120
122
121
123
func TestProductBy (t * testing.T ) {
@@ -128,14 +130,16 @@ func TestProductBy(t *testing.T) {
128
130
result5 := ProductBy ([]uint32 {2 , 3 , 4 , 5 }, func (n uint32 ) uint32 { return n })
129
131
result6 := ProductBy ([]uint32 {}, func (n uint32 ) uint32 { return n })
130
132
result7 := ProductBy ([]complex128 {4_4 , 2_2 }, func (n complex128 ) complex128 { return n })
133
+ result8 := ProductBy (nil , func (n uint32 ) uint32 { return n })
131
134
132
135
is .Equal (result1 , float32 (160.908 ))
133
136
is .Equal (result2 , int32 (120 ))
134
137
is .Equal (result3 , int32 (0 ))
135
138
is .Equal (result4 , int32 (- 126 ))
136
139
is .Equal (result5 , uint32 (120 ))
137
- is .Equal (result6 , uint32 (0 ))
140
+ is .Equal (result6 , uint32 (1 ))
138
141
is .Equal (result7 , complex128 (96_8 ))
142
+ is .Equal (result8 , uint32 (1 ))
139
143
}
140
144
141
145
func TestMean (t * testing.T ) {
0 commit comments