MCPcopy Create free account
hub / github.com/brimdata/super / FuzzQuery

Function FuzzQuery

vector/vector_test.go:14–42  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

12)
13
14func FuzzQuery(f *testing.F) {
15 f.Add([]byte("values f1\x00"))
16 f.Add([]byte("values f1, f2\x00"))
17 f.Add([]byte("f1 == null\x00"))
18 f.Add([]byte("f1 == null | values f2\x00"))
19 f.Fuzz(func(t *testing.T, b []byte) {
20 bytesReader := bytes.NewReader(b)
21 querySource := fuzz.GenAscii(bytesReader)
22 context := super.NewContext()
23 types := fuzz.GenTypes(bytesReader, context, 3)
24 values := fuzz.GenValues(bytesReader, context, types)
25
26 // Debug
27 //for i := range values {
28 // t.Logf("value: in[%v].Bytes()=%v", i, values[i].Bytes())
29 // t.Logf("value: in[%v]=%v", i, sup.String(&values[i]))
30 //}
31
32 var bsupBuf bytes.Buffer
33 fuzz.WriteBSUP(t, values, &bsupBuf)
34 resultBSUP := fuzz.RunQueryBSUP(t, &bsupBuf, querySource)
35
36 var csupBuf bytes.Buffer
37 fuzz.WriteCSUP(t, values, &csupBuf)
38 resultCSUP := fuzz.RunQueryCSUP(t, &csupBuf, querySource)
39
40 fuzz.CompareValues(t, resultBSUP, resultCSUP)
41 })
42}
43
44const N = 10000000
45

Callers

nothing calls this directly

Calls 11

GenAsciiFunction · 0.92
NewContextFunction · 0.92
GenTypesFunction · 0.92
GenValuesFunction · 0.92
WriteBSUPFunction · 0.92
RunQueryBSUPFunction · 0.92
WriteCSUPFunction · 0.92
RunQueryCSUPFunction · 0.92
CompareValuesFunction · 0.92
AddMethod · 0.45
NewReaderMethod · 0.45

Tested by

no test coverage detected