rust/hedgewars-server/src/protocol/test.rs
changeset 15074 c5a6e8566425
parent 14795 add191d825f4
child 15075 e935b1ad23f3
equal deleted inserted replaced
15073:7732013ce64c 15074:c5a6e8566425
     2     arbitrary::{any, any_with, Arbitrary, StrategyFor},
     2     arbitrary::{any, any_with, Arbitrary, StrategyFor},
     3     strategy::{BoxedStrategy, Just, Map, Strategy},
     3     strategy::{BoxedStrategy, Just, Map, Strategy},
     4     test_runner::{Reason, TestRunner},
     4     test_runner::{Reason, TestRunner},
     5 };
     5 };
     6 
     6 
     7 use crate::server::coretypes::{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 {
    73 
    73 
    74 impl Arbitrary for GameCfg {
    74 impl Arbitrary for GameCfg {
    75     type Parameters = ();
    75     type Parameters = ();
    76 
    76 
    77     fn arbitrary_with(_args: <Self as Arbitrary>::Parameters) -> <Self as Arbitrary>::Strategy {
    77     fn arbitrary_with(_args: <Self as Arbitrary>::Parameters) -> <Self as Arbitrary>::Strategy {
    78         use crate::server::coretypes::GameCfg::*;
    78         use crate::core::types::GameCfg::*;
    79         (0..10)
    79         (0..10)
    80             .no_shrink()
    80             .no_shrink()
    81             .prop_flat_map(|i| {
    81             .prop_flat_map(|i| {
    82                 proto_msg_match!(i, def = FeatureSize(0),
    82                 proto_msg_match!(i, def = FeatureSize(0),
    83             0 => FeatureSize(u32),
    83             0 => FeatureSize(u32),