diff -r 1e45db229f9f -r 6a1ba3540fa0 rust/hedgewars-server/src/protocol/test.rs --- a/rust/hedgewars-server/src/protocol/test.rs Mon Jun 03 23:50:26 2019 +0300 +++ b/rust/hedgewars-server/src/protocol/test.rs Tue Jun 04 01:32:08 2019 +0300 @@ -4,7 +4,7 @@ test_runner::{Reason, TestRunner}, }; -use crate::core::types::{GameCfg, HedgehogInfo, ServerVar, ServerVar::*, TeamInfo}; +use crate::core::types::{GameCfg, HedgehogInfo, ServerVar, ServerVar::*, TeamInfo, VoteType}; use super::messages::{HwProtocolMessage, HwProtocolMessage::*}; @@ -166,6 +166,28 @@ type Strategy = BoxedStrategy; } +impl Arbitrary for VoteType { + type Parameters = (); + + fn arbitrary_with(args: Self::Parameters) -> Self::Strategy { + use VoteType::*; + (0..=4) + .no_shrink() + .prop_flat_map(|i| { + proto_msg_match!(i, def = VoteType::Pause, + 0 => Kick(Ascii), + 1 => Map(Option), + 2 => Pause(), + 3 => NewSeed(), + 4 => HedgehogsPerTeam(u8) + ) + }) + .boxed() + } + + type Strategy = BoxedStrategy; +} + pub fn gen_proto_msg() -> BoxedStrategy where { let res = (0..=55).no_shrink().prop_flat_map(|i| { proto_msg_match!(i, def = Ping, @@ -217,7 +239,7 @@ 46 => Fix(), 47 => Unfix(), 48 => Greeting(Option), - //49 => CallVote(Option<(String, Option)>), + 49 => CallVote(Option), 50 => Vote(bool), 51 => ForceVote(bool), 52 => Save(Ascii, Ascii),