Exemplo n.º 1
0
func Fuzz(data []byte) int {
	n, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]
	incX, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]
	lenX, ok := blasfuzz.Int(data, 2)
	if !ok {
		return -1
	}
	data = data[2:]
	x, ok := blasfuzz.F64S(data, lenX)
	if !ok {
		return -1
	}
	data = data[lenX*8:]

	incY, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]
	lenY, ok := blasfuzz.Int(data, 2)
	if !ok {
		return -1
	}
	data = data[2:]
	y, ok := blasfuzz.F64S(data, lenY)
	if !ok {
		return -1
	}
	data = data[lenY*8:]

	alpha, ok := blasfuzz.F64(data)
	if !ok {
		return -1
	}
	data = data[8:]

	beta, ok := blasfuzz.F64(data)
	if !ok {
		return -1
	}
	data = data[8:]

	str := fmt.Sprintf("Case N = %v\n IncX: %v, x: %v\nIncY: %v, y: %v\n alpha: %v", n, incX, x, incY, y, alpha)
	testDaxpy(str, n, alpha, x, incX, y, incY)
	testDcopy(str, n, x, incX, y, incY)
	testDdot(str, n, x, incX, y, incY)
	testDswap(str, n, x, incX, y, incY)
	testDrot(str, n, x, incX, y, incY, alpha, beta)
	return 0
}
Exemplo n.º 2
0
func Fuzz(data []byte) int {
	n, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]
	incX, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]
	lenX, ok := blasfuzz.Int(data, 2)
	if !ok {
		return -1
	}
	data = data[2:]
	x, ok := blasfuzz.F64S(data, lenX)
	if !ok {
		return -1
	}
	data = data[lenX*8:]

	alpha, ok := blasfuzz.F64(data)
	if !ok {
		return -1
	}
	data = data[8:]

	str := fmt.Sprintf("Case. N = %v, IncX = %v, x = %#v, alpha = %v", n, incX, x, alpha)

	testIdamax(str, n, x, incX)
	testDnrm2(str, n, x, incX)
	testDasum(str, n, x, incX)
	testDscal(str, n, x, incX, alpha)
	return 0
}