rust/hedgewars-network-protocol/tests/test.rs
changeset 15811 a855f32ab3ca
parent 15810 ee84e417d8d0
equal deleted inserted replaced
15810:ee84e417d8d0 15811:a855f32ab3ca
    12 use hedgewars_network_protocol::{proto_msg_case, proto_msg_match};
    12 use hedgewars_network_protocol::{proto_msg_case, proto_msg_match};
    13 
    13 
    14 pub fn gen_proto_msg() -> BoxedStrategy<HwProtocolMessage> where {
    14 pub fn gen_proto_msg() -> BoxedStrategy<HwProtocolMessage> where {
    15     use hedgewars_network_protocol::messages::HwProtocolMessage::*;
    15     use hedgewars_network_protocol::messages::HwProtocolMessage::*;
    16 
    16 
    17     let res = (0..=55).no_shrink().prop_flat_map(|i| {
    17     let res = (0..=58).no_shrink().prop_flat_map(|i| {
    18         proto_msg_match!(i, def = Ping,
    18         proto_msg_match!(i, def = Ping,
    19             0 => Ping(),
    19             0 => Ping(),
    20             1 => Pong(),
    20             1 => Pong(),
    21             2 => Quit(Option<Ascii>),
    21             2 => Quit(Option<Ascii>),
    22             4 => Global(Ascii),
    22             4 => Global(Ascii),
    68             50 => Vote(bool),
    68             50 => Vote(bool),
    69             51 => ForceVote(bool),
    69             51 => ForceVote(bool),
    70             52 => Save(Ascii, Ascii),
    70             52 => Save(Ascii, Ascii),
    71             53 => Delete(Ascii),
    71             53 => Delete(Ascii),
    72             54 => SaveRoom(Ascii),
    72             54 => SaveRoom(Ascii),
    73             55 => LoadRoom(Ascii)
    73             55 => LoadRoom(Ascii),
       
    74             56 => CheckerReady(),
       
    75             57 => CheckedOk(Vec<Ascii>),
       
    76             58 => CheckedFail(Ascii)
    74         )
    77         )
    75     });
    78     });
    76     res.boxed()
    79     res.boxed()
    77 }
    80 }
    78 
    81 
    79 pub fn gen_server_msg() -> BoxedStrategy<HwServerMessage> where {
    82 pub fn gen_server_msg() -> BoxedStrategy<HwServerMessage> where {
    80     use hedgewars_network_protocol::messages::HwServerMessage::*;
    83     use hedgewars_network_protocol::messages::HwServerMessage::*;
    81 
    84 
    82     let res = (0..=55).no_shrink().prop_flat_map(|i| {
    85     let res = (0..=38).no_shrink().prop_flat_map(|i| {
    83         proto_msg_match!(i, def = Ping,
    86         proto_msg_match!(i, def = Ping,
    84                     0 => Connected(Ascii, u32),
    87                     0 => Connected(Ascii, u32),
    85                     1 => Redirect(u16),
    88                     1 => Redirect(u16),
    86                     2 => Ping(),
    89                     2 => Ping(),
    87                     3 => Pong(),
    90                     3 => Pong(),
   116                     32 => Info(Vec<Ascii>),
   119                     32 => Info(Vec<Ascii>),
   117                     33 => ServerMessage(Ascii),
   120                     33 => ServerMessage(Ascii),
   118                     34 => ServerVars(Vec<Ascii>),
   121                     34 => ServerVars(Vec<Ascii>),
   119                     35 => Notice(Ascii),
   122                     35 => Notice(Ascii),
   120                     36 => Warning(Ascii),
   123                     36 => Warning(Ascii),
   121                     37 => Error(Ascii)
   124                     37 => Error(Ascii),
       
   125                     38 => Replay(Vec<Ascii>)
   122                 )
   126                 )
   123     });
   127     });
   124     res.boxed()
   128     res.boxed()
   125 }
   129 }
   126 
   130