BDE 4.14.0 Production release
|
Provide fuzz test utilities for basic types.
This component provides a namespace, bslim::FuzzUtil
, containing functions that create fundamental and standard library types from fuzz data provided by a fuzz harness (e.g., libFuzzer
).
See {http://bburl/BDEFuzzTesting} for details on how to build and run with fuzz testing enabled.
This section illustrates intended use of this component.
Suppose we wish to fuzz test a function with preconditions.
First, we define the TradingInterfaceUnderTest
struct
:
Then, we need a block of raw bytes. This would normally come from a fuzz harness (e.g., the LLVMFuzzerTestOneInput
entry point function from libFuzzer
). Since libFuzzer
is not available here, we initialize a myFuzzData
array that we will use instead.
Next, we create a FuzzDataView
to wrap the raw bytes.
Now, we pass this FuzzDataView
to FuzzUtil
to generate values within the permissible range of the function under test:
Finally, we can use these int
values to pass to a function that returns the number of earnings announcements scheduled in a given month.