rust/hedgewars-server/src/protocol/test.rs
changeset 15075 e935b1ad23f3
parent 15074 c5a6e8566425
child 15111 1e45db229f9f
equal deleted inserted replaced
15074:c5a6e8566425 15075:e935b1ad23f3
     4     test_runner::{Reason, TestRunner},
     4     test_runner::{Reason, TestRunner},
     5 };
     5 };
     6 
     6 
     7 use crate::core::types::{GameCfg, HedgehogInfo, ServerVar, ServerVar::*, TeamInfo};
     7 use crate::core::types::{GameCfg, HedgehogInfo, ServerVar, ServerVar::*, TeamInfo};
     8 
     8 
     9 use super::messages::{HWProtocolMessage, HWProtocolMessage::*};
     9 use super::messages::{HwProtocolMessage, HwProtocolMessage::*};
    10 
    10 
    11 // Due to inability to define From between Options
    11 // Due to inability to define From between Options
    12 trait Into2<T>: Sized {
    12 trait Into2<T>: Sized {
    13     fn into2(self) -> T;
    13     fn into2(self) -> T;
    14 }
    14 }
   164     }
   164     }
   165 
   165 
   166     type Strategy = BoxedStrategy<ServerVar>;
   166     type Strategy = BoxedStrategy<ServerVar>;
   167 }
   167 }
   168 
   168 
   169 pub fn gen_proto_msg() -> BoxedStrategy<HWProtocolMessage> where {
   169 pub fn gen_proto_msg() -> BoxedStrategy<HwProtocolMessage> where {
   170     let res = (0..=55).no_shrink().prop_flat_map(|i| {
   170     let res = (0..=55).no_shrink().prop_flat_map(|i| {
   171         proto_msg_match!(i, def = Ping,
   171         proto_msg_match!(i, def = Ping,
   172             0 => Ping(),
   172             0 => Ping(),
   173             1 => Pong(),
   173             1 => Pong(),
   174             2 => Quit(Option<Ascii>),
   174             2 => Quit(Option<Ascii>),