Add fuzz targets for Writeable messages/migrate fuzz test
[rust-lightning] / fuzz / fuzz_targets / msg_targets / msg_target_template.txt
1 // This file is auto-generated by gen_target.sh based on msg_target_template.txt
2 // To modify it, modify msg_target_template.txt and run gen_target.sh instead.
3
4 extern crate lightning;
5
6 use lightning::ln::msgs;
7 use lightning::util::reset_rng_state;
8
9 mod utils;
10
11 #[inline]
12 pub fn do_test(data: &[u8]) {
13         reset_rng_state();
14         TEST_MSG!(msgs::MSG_TARGET, dataEXTRA_ARGS);
15 }
16
17 #[cfg(feature = "afl")]
18 #[macro_use] extern crate afl;
19 #[cfg(feature = "afl")]
20 fn main() {
21         fuzz!(|data| {
22                 do_test(data);
23         });
24 }
25
26 #[cfg(feature = "honggfuzz")]
27 #[macro_use] extern crate honggfuzz;
28 #[cfg(feature = "honggfuzz")]
29 fn main() {
30         loop {
31                 fuzz!(|data| {
32                         do_test(data);
33                 });
34         }
35 }
36
37 extern crate hex;
38 #[cfg(test)]
39 mod tests {
40         #[test]
41         fn duplicate_crash() {
42                 super::do_test(&::hex::decode("00").unwrap());
43         }
44 }