forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34fdeeb
commit 79949c5
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//go:build fuzz | ||
// +build fuzz | ||
|
||
package gocql | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
// FuzzMarshalFloat64Ptr aimed to repeatedly test float64 marshaling with generated inputs based on seed corpus. | ||
func FuzzMarshalFloat64Ptr(f *testing.F) { | ||
f.Add(float64(7500), float64(7500.00)) | ||
|
||
f.Fuzz(func(t *testing.T, num, numWithPoints float64) { | ||
session := createSession(t) | ||
defer session.Close() | ||
|
||
if err := createTable(session, "CREATE TABLE IF NOT EXISTS gocql_test.float_test (id double, test double, primary key (id))"); err != nil { | ||
t.Fatal("create table:", err) | ||
} | ||
|
||
if err := session.Query(`TRUNCATE TABLE gocql_test.float_test`).Exec(); err != nil { | ||
t.Fatal("truncate table:", err) | ||
} | ||
|
||
if err := session.Query(`INSERT INTO float_test (id,test) VALUES (?,?)`, numWithPoints, &num).Exec(); err != nil { | ||
t.Fatal("insert float64:", err) | ||
} | ||
}) | ||
} |