Merge pull request #30 from TheBlueMatt/master
[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 use lightning::ln::msgs::{MsgEncodable, MsgDecodable};
10
11 mod utils;
12
13 #[inline]
14 pub fn do_test(data: &[u8]) {
15         reset_rng_state();
16         test_msg!(msgs::Shutdown, data);
17 }
18
19 #[cfg(feature = "afl")]
20 extern crate afl;
21 #[cfg(feature = "afl")]
22 fn main() {
23         afl::read_stdio_bytes(|data| {
24                 do_test(&data);
25         });
26 }
27
28 #[cfg(feature = "honggfuzz")]
29 #[macro_use] extern crate honggfuzz;
30 #[cfg(feature = "honggfuzz")]
31 fn main() {
32         loop {
33                 fuzz!(|data| {
34                         do_test(data);
35                 });
36         }
37 }
38
39 #[cfg(test)]
40 mod tests {
41         use utils::extend_vec_from_hex;
42         #[test]
43         fn duplicate_crash() {
44                 let mut a = Vec::new();
45                 extend_vec_from_hex("00", &mut a);
46                 super::do_test(&a);
47         }
48 }