コード例 #1
0
ファイル: twovec.go プロジェクト: btracey/blasfuzz
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
}
コード例 #2
0
ファイル: idamax.go プロジェクト: btracey/blasfuzz
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
}
コード例 #3
0
ファイル: all.go プロジェクト: btracey/blasfuzz
func Fuzz(data []byte) int {
	n, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]

	// Construct slice 1
	incX, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	lenX, ok := blasfuzz.Int(data, 2)
	if !ok {
		return 0
	}
	data = data[2:]
	x, ok := blasfuzz.F64S(data, lenX)
	if !ok {
		return 0
	}
	data = data[lenX*8:]

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

	// Construct matrix 1
	m1, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	n1, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	ld1, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	lenA := ld1*m1 + n1
	a, ok := blasfuzz.F64S(data, lenA)
	if !ok {
		return 0
	}
	data = data[lenA*8:]

	// Construct matrix 2
	m2, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	n2, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	ld2, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	lenB := ld2*m2 + n2
	b, ok := blasfuzz.F64S(data, lenB)
	if !ok {
		return 0
	}
	data = data[lenB*8:]

	// Construct matrix 3
	m3, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	n3, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	ld3, ok := blasfuzz.Int(data, 1)
	if !ok {
		return 0
	}
	data = data[1:]
	lenC := ld3*m3 + n3
	c, ok := blasfuzz.F64S(data, lenC)
	if !ok {
		return 0
	}
	data = data[lenC*8:]

	// Generate a couple of parameters and booleans
	nParams := 8
	params, ok := blasfuzz.F64S(data, nParams)
	if !ok {
		return 0
	}
	data = data[nParams*8:]

	// Generate a couple of booleans
	bools, ok := blasfuzz.Bools(data)
	if !ok {
		return 0
	}
	data = data[1:]

	// Generate an integer
	iParam, ok := blasfuzz.Int(data, 1)
	if !ok {
		return -1
	}
	data = data[1:]

	_, _, _ = a, b, c
	_ = bools

	// Test the functions
	level1Test(n, x, lenX, incX, y, lenY, incY, params, iParam)

	return 1
}