d64efcc9f176df15e80593d2f681be1cf9b7807a
[rust-lightning] / fuzz / fuzz_targets / msg_targets / msg_shutdown_target.rs
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 use utils::VecWriter;
11
12 #[inline]
13 pub fn do_test(data: &[u8]) {
14         reset_rng_state();
15         test_msg!(msgs::Shutdown, data);
16 }
17
18 #[cfg(feature = "afl")]
19 #[macro_use] extern crate afl;
20 #[cfg(feature = "afl")]
21 fn main() {
22         fuzz!(|data| {
23                 do_test(data);
24         });
25 }
26
27 #[cfg(feature = "honggfuzz")]
28 #[macro_use] extern crate honggfuzz;
29 #[cfg(feature = "honggfuzz")]
30 fn main() {
31         loop {
32                 fuzz!(|data| {
33                         do_test(data);
34                 });
35         }
36 }
37
38 extern crate hex;
39 #[cfg(test)]
40 mod tests {
41         #[test]
42         fn duplicate_crash() {
43                 super::do_test(&::hex::decode("00").unwrap());
44         }
45 }