gitee.com/quant1x/num@v0.3.2/asm/c2goasm/test/MaddConstant_test.go (about) 1 package c2goasmtest 2 3 import ( 4 "testing" 5 ) 6 7 func TestMaddConstant(t *testing.T) { 8 9 f1 := [8]float32{} 10 f2 := [8]float32{} 11 12 for i := 0; i < 8; i++ { 13 f1[i] = float32(i) 14 f2[i] = float32(i * 2) 15 } 16 17 f3 := MaddConstant(f1, f2) 18 19 for i := 0; i < 8; i++ { 20 expected := f1[i]*f2[i] + float32(i+1) 21 if f3[i] != expected { 22 t.Errorf("TestMaddConstant(): \nexpected %f\ngot %f", expected, f3[i]) 23 } 24 } 25 }