sway
sway copied to clipboard
[Tracking] Introduce fuzz testing to forc-test
forc-test should support fuzzing with its testing capabilities. For a given sway unit test, forc-test should be able to fuzz the code to help programmers discover edge cases in their functions/methods etc.
fn add(a: u32, b:u32) -> u32 {
if (a > 20) {
assert!(2 == 3)
}
a + b
}
#[test(fuzz)]
fn test_add(a: u32, b: u32) {
assert!(a+b, add(a, b))
}
Fuzzing can be totally random to get things started but eventually we could build something like a concolic execution engine for sway so that fuzzing can be more "informed" while trying random inputs.
TODO
- [ ] #5595
- [ ] #5593
Related https://github.com/FuelLabs/sway/issues/5928