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