@@ -108,14 +108,16 @@ func TestProduct(t *testing.T) {
108108 result5 := Product ([]uint32 {2 , 3 , 4 , 5 })
109109 result6 := Product ([]uint32 {})
110110 result7 := Product ([]complex128 {4_4 , 2_2 })
111+ result8 := Product [uint32 ](nil )
111112
112113 is .Equal (result1 , float32 (160.908 ))
113114 is .Equal (result2 , int32 (120 ))
114115 is .Equal (result3 , int32 (0 ))
115116 is .Equal (result4 , int32 (- 126 ))
116117 is .Equal (result5 , uint32 (120 ))
117- is .Equal (result6 , uint32 (0 ))
118+ is .Equal (result6 , uint32 (1 ))
118119 is .Equal (result7 , complex128 (96_8 ))
120+ is .Equal (result8 , uint32 (1 ))
119121}
120122
121123func TestProductBy (t * testing.T ) {
@@ -128,14 +130,16 @@ func TestProductBy(t *testing.T) {
128130 result5 := ProductBy ([]uint32 {2 , 3 , 4 , 5 }, func (n uint32 ) uint32 { return n })
129131 result6 := ProductBy ([]uint32 {}, func (n uint32 ) uint32 { return n })
130132 result7 := ProductBy ([]complex128 {4_4 , 2_2 }, func (n complex128 ) complex128 { return n })
133+ result8 := ProductBy (nil , func (n uint32 ) uint32 { return n })
131134
132135 is .Equal (result1 , float32 (160.908 ))
133136 is .Equal (result2 , int32 (120 ))
134137 is .Equal (result3 , int32 (0 ))
135138 is .Equal (result4 , int32 (- 126 ))
136139 is .Equal (result5 , uint32 (120 ))
137- is .Equal (result6 , uint32 (0 ))
140+ is .Equal (result6 , uint32 (1 ))
138141 is .Equal (result7 , complex128 (96_8 ))
142+ is .Equal (result8 , uint32 (1 ))
139143}
140144
141145func TestMean (t * testing.T ) {
0 commit comments