aboutsummaryrefslogtreecommitdiff
path: root/src/status.rs
diff options
context:
space:
mode:
authorJoey Sacchini <joey@sacchini.net>2020-09-29 17:05:58 -0400
committerJoey Sacchini <joey@sacchini.net>2020-09-29 17:05:58 -0400
commit56181da142f5e95a067feea5c4558fef2a2d49a7 (patch)
tree08d5bbcaaa13cf915248cf9dba2a0955d4b573cf /src/status.rs
parent2e6119a65f260f460dd67860dd5f5af7286bcb42 (diff)
downloadmcproto-rs-56181da142f5e95a067feea5c4558fef2a2d49a7.tar.gz
mcproto-rs-56181da142f5e95a067feea5c4558fef2a2d49a7.tar.bz2
mcproto-rs-56181da142f5e95a067feea5c4558fef2a2d49a7.zip
implement automated testing of all data-types
Diffstat (limited to 'src/status.rs')
-rw-r--r--src/status.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/status.rs b/src/status.rs
index b8f9029..7d254aa 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -3,6 +3,7 @@ use crate::{SerializeResult, SerializeErr, Serialize as McSerialize, Deserialize
use crate::uuid::UUID4;
use serde::{Serialize, Serializer, Deserialize, Deserializer};
use std::fmt;
+use crate::protocol::TestRandom;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct StatusSpec {
@@ -31,6 +32,26 @@ impl McDeserialize for StatusSpec {
}
}
+
+#[cfg(test)]
+impl TestRandom for StatusSpec {
+ fn test_gen_random() -> Self {
+ Self {
+ version: StatusVersionSpec{
+ protocol: rand::random(),
+ name: String::test_gen_random(),
+ },
+ players: StatusPlayersSpec{
+ sample: Vec::default(),
+ max: rand::random(),
+ online: rand::random(),
+ },
+ favicon: None,
+ description: Chat::test_gen_random(),
+ }
+ }
+}
+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct StatusVersionSpec {
pub name: String,