diff --git a/src/attention.rs b/src/attention.rs index 398b2bf..4bfffd7 100644 --- a/src/attention.rs +++ b/src/attention.rs @@ -20,6 +20,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(Attention, 0); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/bind.rs b/src/bind.rs index 1922093..6bfa8a3 100644 --- a/src/bind.rs +++ b/src/bind.rs @@ -98,6 +98,11 @@ impl From for Element { mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(Bind, 80); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/blocking.rs b/src/blocking.rs index 6b6894c..87a2fbd 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -98,6 +98,14 @@ generate_empty_element!( mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(BlocklistRequest, 0); + assert_size!(BlocklistResult, 24); + assert_size!(Block, 24); + assert_size!(Unblock, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/bookmarks.rs b/src/bookmarks.rs index 11b4a42..8ae0639 100644 --- a/src/bookmarks.rs +++ b/src/bookmarks.rs @@ -74,6 +74,13 @@ mod tests { use minidom::Element; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(Conference, 152); + assert_size!(Url, 48); + assert_size!(Storage, 48); + } + #[test] fn empty() { let elem: Element = "".parse().unwrap(); diff --git a/src/caps.rs b/src/caps.rs index 25c851f..7fcaea8 100644 --- a/src/caps.rs +++ b/src/caps.rs @@ -211,6 +211,11 @@ mod tests { use caps; use base64; + #[test] + fn test_size() { + assert_size!(Caps, 104); + } + #[test] fn test_parse() { let elem: Element = "".parse().unwrap(); diff --git a/src/chatstates.rs b/src/chatstates.rs index c9fabd5..477bdde 100644 --- a/src/chatstates.rs +++ b/src/chatstates.rs @@ -37,6 +37,11 @@ mod tests { use error::Error; use ns; + #[test] + fn test_size() { + assert_size!(ChatState, 1); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/component.rs b/src/component.rs index 27229f2..503e103 100644 --- a/src/component.rs +++ b/src/component.rs @@ -47,6 +47,11 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(Handshake, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/data_forms.rs b/src/data_forms.rs index a439779..3fccd72 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -268,6 +268,15 @@ impl From for Element { mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(Option_, 48); + assert_size!(FieldType, 1); + assert_size!(Field, 128); + assert_size!(DataFormType, 1); + assert_size!(DataForm, 104); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/date.rs b/src/date.rs index a344eb5..5f2038d 100644 --- a/src/date.rs +++ b/src/date.rs @@ -43,6 +43,11 @@ mod tests { use chrono::{Datelike, Timelike}; use std::error::Error as StdError; + #[test] + fn test_size() { + assert_size!(DateTime, 16); + } + #[test] fn test_simple() { let date: DateTime = "2002-09-10T23:08:25Z".parse().unwrap(); diff --git a/src/delay.rs b/src/delay.rs index 581e72e..c4f7518 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -39,6 +39,11 @@ mod tests { use error::Error; use std::str::FromStr; + #[test] + fn test_size() { + assert_size!(Delay, 112); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/disco.rs b/src/disco.rs index 59166eb..7b43553 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -235,6 +235,18 @@ mod tests { use compare_elements::NamespaceAwareCompare; use std::str::FromStr; + #[test] + fn test_size() { + assert_size!(Identity, 96); + assert_size!(Feature, 24); + assert_size!(DiscoInfoQuery, 24); + assert_size!(DiscoInfoResult, 96); + + assert_size!(Item, 120); + assert_size!(DiscoItemsQuery, 24); + assert_size!(DiscoItemsResult, 48); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/ecaps2.rs b/src/ecaps2.rs index 6e71040..d4811b5 100644 --- a/src/ecaps2.rs +++ b/src/ecaps2.rs @@ -152,6 +152,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(ECaps2, 24); + } + #[test] fn test_parse() { let elem: Element = "K1Njy3HZBThlo4moOD5gBGhn0U0oK7/CbfLlIUDi6o4=+sDTQqBmX6iG/X3zjt06fjZMBBqL/723knFIyRf0sg8=".parse().unwrap(); diff --git a/src/eme.rs b/src/eme.rs index 51eb2a6..271b842 100644 --- a/src/eme.rs +++ b/src/eme.rs @@ -28,6 +28,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(ExplicitMessageEncryption, 48); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/forwarding.rs b/src/forwarding.rs index b65b450..fbfacb1 100644 --- a/src/forwarding.rs +++ b/src/forwarding.rs @@ -30,6 +30,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(Forwarded, 392); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/hashes.rs b/src/hashes.rs index bf7fafb..7063dbc 100644 --- a/src/hashes.rs +++ b/src/hashes.rs @@ -133,6 +133,12 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(Algo, 32); + assert_size!(Hash, 56); + } + #[test] fn test_simple() { let elem: Element = "2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=".parse().unwrap(); diff --git a/src/ibb.rs b/src/ibb.rs index bede2f0..e595fe4 100644 --- a/src/ibb.rs +++ b/src/ibb.rs @@ -76,6 +76,14 @@ mod tests { use error::Error; use std::error::Error as StdError; + #[test] + fn test_size() { + assert_size!(Stanza, 1); + assert_size!(Open, 32); + assert_size!(Data, 56); + assert_size!(Close, 24); + } + #[test] fn test_simple() { let sid = StreamId(String::from("coucou")); diff --git a/src/ibr.rs b/src/ibr.rs index 72324de..71256b6 100644 --- a/src/ibr.rs +++ b/src/ibr.rs @@ -96,6 +96,11 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(Query, 152); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/idle.rs b/src/idle.rs index 2704654..45352a2 100644 --- a/src/idle.rs +++ b/src/idle.rs @@ -27,6 +27,11 @@ mod tests { use std::str::FromStr; use std::error::Error as StdError; + #[test] + fn test_size() { + assert_size!(Idle, 16); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/iq.rs b/src/iq.rs index aeeb836..b5f27bf 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -226,6 +226,12 @@ mod tests { use compare_elements::NamespaceAwareCompare; use disco::DiscoInfoQuery; + #[test] + fn test_size() { + assert_size!(IqType, 216); + assert_size!(Iq, 384); + } + #[test] fn test_require_type() { #[cfg(not(feature = "component"))] diff --git a/src/jingle.rs b/src/jingle.rs index 3102b10..38577f8 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -533,6 +533,20 @@ impl From for Element { mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(Action, 1); + assert_size!(Creator, 1); + assert_size!(Senders, 1); + assert_size!(Disposition, 1); + assert_size!(ContentId, 24); + assert_size!(Content, 344); + assert_size!(Reason, 1); + assert_size!(ReasonElement, 32); + assert_size!(SessionId, 24); + assert_size!(Jingle, 256); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs index e206ab3..0a3c022 100644 --- a/src/jingle_ft.rs +++ b/src/jingle_ft.rs @@ -348,6 +348,15 @@ mod tests { use hashes::Algo; use base64; + #[test] + fn test_size() { + assert_size!(Range, 48); + assert_size!(File, 184); + assert_size!(Description, 184); + assert_size!(Checksum, 216); + assert_size!(Received, 32); + } + #[test] fn test_description() { let elem: Element = r#" diff --git a/src/jingle_ibb.rs b/src/jingle_ibb.rs index 7438133..c56c73d 100644 --- a/src/jingle_ibb.rs +++ b/src/jingle_ibb.rs @@ -29,6 +29,11 @@ mod tests { use error::Error; use std::error::Error as StdError; + #[test] + fn test_size() { + assert_size!(Transport, 32); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/jingle_message.rs b/src/jingle_message.rs index d8e3038..150e7a0 100644 --- a/src/jingle_message.rs +++ b/src/jingle_message.rs @@ -121,6 +121,11 @@ impl From for Element { mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(JingleMI, 136); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/jingle_s5b.rs b/src/jingle_s5b.rs index f6f05be..a5fdff0 100644 --- a/src/jingle_s5b.rs +++ b/src/jingle_s5b.rs @@ -277,6 +277,17 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(Type, 1); + assert_size!(Mode, 1); + assert_size!(CandidateId, 24); + assert_size!(StreamId, 24); + assert_size!(Candidate, 128); + assert_size!(TransportPayload, 32); + assert_size!(Transport, 88); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/macros.rs b/src/macros.rs index 5793fef..3deade1 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -510,3 +510,9 @@ macro_rules! generate_element { } ); } + +macro_rules! assert_size ( + ($t:ty, $sz:expr) => ( + assert_eq!(::std::mem::size_of::<$t>(), $sz); + ); +); diff --git a/src/mam.rs b/src/mam.rs index 11850a2..4456412 100644 --- a/src/mam.rs +++ b/src/mam.rs @@ -191,6 +191,17 @@ mod tests { use super::*; use std::str::FromStr; + #[test] + fn test_size() { + assert_size!(QueryId, 24); + assert_size!(Query, 232); + assert_size!(Result_, 440); + assert_size!(Complete, 1); + assert_size!(Fin, 88); + assert_size!(DefaultPrefs, 1); + assert_size!(Prefs, 56); + } + #[test] fn test_query() { let elem: Element = "".parse().unwrap(); diff --git a/src/media_element.rs b/src/media_element.rs index 7ad264b..722780f 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -51,6 +51,12 @@ mod tests { use data_forms::DataForm; use std::error::Error as StdError; + #[test] + fn test_size() { + assert_size!(URI, 48); + assert_size!(MediaElement, 56); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/message.rs b/src/message.rs index 7506a3f..2e9d9c6 100644 --- a/src/message.rs +++ b/src/message.rs @@ -234,6 +234,15 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(MessageType, 1); + assert_size!(Body, 24); + assert_size!(Subject, 24); + assert_size!(Thread, 24); + assert_size!(Message, 272); + } + #[test] fn test_simple() { #[cfg(not(feature = "component"))] diff --git a/src/message_correct.rs b/src/message_correct.rs index 0483451..e8233ee 100644 --- a/src/message_correct.rs +++ b/src/message_correct.rs @@ -25,6 +25,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(Replace, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/mood.rs b/src/mood.rs index 8612a42..6bf8bd2 100644 --- a/src/mood.rs +++ b/src/mood.rs @@ -272,6 +272,12 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(MoodEnum, 1); + assert_size!(Text, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/nick.rs b/src/nick.rs index 9844e93..2d2f90c 100644 --- a/src/nick.rs +++ b/src/nick.rs @@ -16,6 +16,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(Nick, 24); + } + #[test] fn test_simple() { let elem: Element = "Link Mauve".parse().unwrap(); diff --git a/src/ping.rs b/src/ping.rs index 0af81c0..557f535 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -22,6 +22,11 @@ mod tests { use minidom::Element; use error::Error; + #[test] + fn test_size() { + assert_size!(Ping, 0); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/presence.rs b/src/presence.rs index 8bde178..02a9a9c 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -323,6 +323,13 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(Show, 1); + assert_size!(Type, 1); + assert_size!(Presence, 224); + } + #[test] fn test_simple() { #[cfg(not(feature = "component"))] diff --git a/src/receipts.rs b/src/receipts.rs index 898a5dd..ecf0a21 100644 --- a/src/receipts.rs +++ b/src/receipts.rs @@ -33,6 +33,12 @@ mod tests { use minidom::Element; use ns; + #[test] + fn test_size() { + assert_size!(Request, 0); + assert_size!(Received, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/roster.rs b/src/roster.rs index 0bb7439..eeebddf 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -85,6 +85,14 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(Group, 24); + assert_size!(Subscription, 1); + assert_size!(Item, 128); + assert_size!(Roster, 48); + } + #[test] fn test_get() { let elem: Element = "".parse().unwrap(); diff --git a/src/rsm.rs b/src/rsm.rs index d16751a..2f17693 100644 --- a/src/rsm.rs +++ b/src/rsm.rs @@ -158,6 +158,12 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(SetQuery, 80); + assert_size!(SetResult, 80); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/sasl.rs b/src/sasl.rs index f27167b..5272fd0 100644 --- a/src/sasl.rs +++ b/src/sasl.rs @@ -215,6 +215,18 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(Mechanism, 1); + assert_size!(Auth, 32); + assert_size!(Challenge, 24); + assert_size!(Response, 24); + assert_size!(Abort, 0); + assert_size!(Success, 24); + assert_size!(DefinedCondition, 1); + assert_size!(Failure, 32); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/sm.rs b/src/sm.rs index e93aa24..dfc3dff 100644 --- a/src/sm.rs +++ b/src/sm.rs @@ -144,6 +144,20 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(A, 4); + assert_size!(ResumeAttr, 1); + assert_size!(Enable, 12); + assert_size!(StreamId, 24); + assert_size!(Enabled, 64); + assert_size!(Failed, 12); + assert_size!(R, 0); + assert_size!(Resume, 32); + assert_size!(Resumed, 32); + assert_size!(StreamManagement, 0); + } + #[test] fn a() { let elem: Element = " for Element { mod tests { use super::*; + #[test] + fn test_size() { + assert_size!(ErrorType, 1); + assert_size!(DefinedCondition, 1); + assert_size!(StanzaError, 208); + } + #[test] fn test_simple() { #[cfg(not(feature = "component"))] diff --git a/src/stanza_id.rs b/src/stanza_id.rs index 07e947a..9dc3698 100644 --- a/src/stanza_id.rs +++ b/src/stanza_id.rs @@ -42,6 +42,12 @@ mod tests { use error::Error; use std::str::FromStr; + #[test] + fn test_size() { + assert_size!(StanzaId, 96); + assert_size!(OriginId, 24); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/stream.rs b/src/stream.rs index 693796d..b81ba77 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -76,6 +76,11 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(Stream, 216); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap(); diff --git a/src/version.rs b/src/version.rs index 4354df5..7ed8974 100644 --- a/src/version.rs +++ b/src/version.rs @@ -43,6 +43,12 @@ mod tests { use minidom::Element; use compare_elements::NamespaceAwareCompare; + #[test] + fn test_size() { + assert_size!(VersionQuery, 0); + assert_size!(VersionResult, 72); + } + #[test] fn simple() { let elem: Element = "xmpp-rs0.3.0".parse().unwrap(); diff --git a/src/websocket.rs b/src/websocket.rs index 102690c..2f87437 100644 --- a/src/websocket.rs +++ b/src/websocket.rs @@ -75,6 +75,11 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[test] + fn test_size() { + assert_size!(Open, 216); + } + #[test] fn test_simple() { let elem: Element = "".parse().unwrap();