From 7a2dcbee017a1757e5f581df7fa1363dea9dc223 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 28 Oct 2018 13:10:48 +0100 Subject: [PATCH] Test struct sizes on 32-bit too. --- src/bind.rs | 7 +++++++ src/blocking.rs | 10 ++++++++++ src/bookmarks.rs | 9 +++++++++ src/caps.rs | 7 +++++++ src/component.rs | 7 +++++++ src/data_forms.rs | 11 +++++++++++ src/delay.rs | 7 +++++++ src/disco.rs | 14 ++++++++++++++ src/ecaps2.rs | 7 +++++++ src/eme.rs | 7 +++++++ src/forwarding.rs | 7 +++++++ src/hashes.rs | 8 ++++++++ src/ibb.rs | 10 ++++++++++ src/ibr.rs | 7 +++++++ src/iq.rs | 8 ++++++++ src/jingle.rs | 16 ++++++++++++++++ src/jingle_ft.rs | 11 +++++++++++ src/jingle_ibb.rs | 7 +++++++ src/jingle_message.rs | 7 +++++++ src/jingle_s5b.rs | 13 +++++++++++++ src/mam.rs | 13 +++++++++++++ src/media_element.rs | 8 ++++++++ src/message.rs | 11 +++++++++++ src/message_correct.rs | 7 +++++++ src/mood.rs | 8 ++++++++ src/nick.rs | 7 +++++++ src/presence.rs | 9 +++++++++ src/receipts.rs | 8 ++++++++ src/roster.rs | 10 ++++++++++ src/rsm.rs | 8 ++++++++ src/sasl.rs | 14 ++++++++++++++ src/sm.rs | 16 ++++++++++++++++ src/stanza_error.rs | 9 +++++++++ src/stanza_id.rs | 8 ++++++++ src/stream.rs | 7 +++++++ src/version.rs | 8 ++++++++ src/websocket.rs | 7 +++++++ 37 files changed, 338 insertions(+) diff --git a/src/bind.rs b/src/bind.rs index 6bfa8a3..b6ec55d 100644 --- a/src/bind.rs +++ b/src/bind.rs @@ -98,6 +98,13 @@ impl From for Element { mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Bind, 40); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Bind, 80); diff --git a/src/blocking.rs b/src/blocking.rs index 87a2fbd..cd3f8fd 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -98,6 +98,16 @@ generate_empty_element!( mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(BlocklistRequest, 0); + assert_size!(BlocklistResult, 12); + assert_size!(Block, 12); + assert_size!(Unblock, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(BlocklistRequest, 0); diff --git a/src/bookmarks.rs b/src/bookmarks.rs index 8ae0639..7f68930 100644 --- a/src/bookmarks.rs +++ b/src/bookmarks.rs @@ -74,6 +74,15 @@ mod tests { use minidom::Element; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Conference, 76); + assert_size!(Url, 24); + assert_size!(Storage, 24); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Conference, 152); diff --git a/src/caps.rs b/src/caps.rs index 7fcaea8..22ac193 100644 --- a/src/caps.rs +++ b/src/caps.rs @@ -211,6 +211,13 @@ mod tests { use caps; use base64; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Caps, 52); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Caps, 104); diff --git a/src/component.rs b/src/component.rs index 503e103..0c9319c 100644 --- a/src/component.rs +++ b/src/component.rs @@ -47,6 +47,13 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Handshake, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Handshake, 24); diff --git a/src/data_forms.rs b/src/data_forms.rs index 3fccd72..edf2608 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -268,6 +268,17 @@ impl From for Element { mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Option_, 24); + assert_size!(FieldType, 1); + assert_size!(Field, 64); + assert_size!(DataFormType, 1); + assert_size!(DataForm, 52); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Option_, 48); diff --git a/src/delay.rs b/src/delay.rs index c4f7518..46fec0f 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -39,6 +39,13 @@ mod tests { use error::Error; use std::str::FromStr; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Delay, 64); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Delay, 112); diff --git a/src/disco.rs b/src/disco.rs index 7b43553..7be0efc 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -235,6 +235,20 @@ mod tests { use compare_elements::NamespaceAwareCompare; use std::str::FromStr; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Identity, 48); + assert_size!(Feature, 12); + assert_size!(DiscoInfoQuery, 12); + assert_size!(DiscoInfoResult, 48); + + assert_size!(Item, 60); + assert_size!(DiscoItemsQuery, 12); + assert_size!(DiscoItemsResult, 24); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Identity, 96); diff --git a/src/ecaps2.rs b/src/ecaps2.rs index d4811b5..ea5e03d 100644 --- a/src/ecaps2.rs +++ b/src/ecaps2.rs @@ -152,6 +152,13 @@ mod tests { use minidom::Element; use error::Error; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(ECaps2, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(ECaps2, 24); diff --git a/src/eme.rs b/src/eme.rs index 271b842..417bbe5 100644 --- a/src/eme.rs +++ b/src/eme.rs @@ -28,6 +28,13 @@ mod tests { use minidom::Element; use error::Error; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(ExplicitMessageEncryption, 24); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(ExplicitMessageEncryption, 48); diff --git a/src/forwarding.rs b/src/forwarding.rs index fbfacb1..11efb61 100644 --- a/src/forwarding.rs +++ b/src/forwarding.rs @@ -30,6 +30,13 @@ mod tests { use minidom::Element; use error::Error; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Forwarded, 204); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Forwarded, 392); diff --git a/src/hashes.rs b/src/hashes.rs index 7063dbc..5fbf5b9 100644 --- a/src/hashes.rs +++ b/src/hashes.rs @@ -133,6 +133,14 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Algo, 16); + assert_size!(Hash, 28); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Algo, 32); diff --git a/src/ibb.rs b/src/ibb.rs index e595fe4..87b335e 100644 --- a/src/ibb.rs +++ b/src/ibb.rs @@ -76,6 +76,16 @@ mod tests { use error::Error; use std::error::Error as StdError; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Stanza, 1); + assert_size!(Open, 16); + assert_size!(Data, 28); + assert_size!(Close, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Stanza, 1); diff --git a/src/ibr.rs b/src/ibr.rs index 71256b6..4d76a9d 100644 --- a/src/ibr.rs +++ b/src/ibr.rs @@ -96,6 +96,13 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Query, 88); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Query, 152); diff --git a/src/iq.rs b/src/iq.rs index b5f27bf..ff1e7b1 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -226,6 +226,14 @@ mod tests { use compare_elements::NamespaceAwareCompare; use disco::DiscoInfoQuery; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(IqType, 108); + assert_size!(Iq, 192); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(IqType, 216); diff --git a/src/jingle.rs b/src/jingle.rs index 38577f8..7e4ea82 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -533,6 +533,22 @@ impl From for Element { mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Action, 1); + assert_size!(Creator, 1); + assert_size!(Senders, 1); + assert_size!(Disposition, 1); + assert_size!(ContentId, 12); + assert_size!(Content, 172); + assert_size!(Reason, 1); + assert_size!(ReasonElement, 16); + assert_size!(SessionId, 12); + assert_size!(Jingle, 128); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Action, 1); diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs index 0a3c022..604e6ee 100644 --- a/src/jingle_ft.rs +++ b/src/jingle_ft.rs @@ -348,6 +348,17 @@ mod tests { use hashes::Algo; use base64; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Range, 40); + assert_size!(File, 128); + assert_size!(Description, 128); + assert_size!(Checksum, 144); + assert_size!(Received, 16); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Range, 48); diff --git a/src/jingle_ibb.rs b/src/jingle_ibb.rs index c56c73d..e02a434 100644 --- a/src/jingle_ibb.rs +++ b/src/jingle_ibb.rs @@ -29,6 +29,13 @@ mod tests { use error::Error; use std::error::Error as StdError; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Transport, 16); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Transport, 32); diff --git a/src/jingle_message.rs b/src/jingle_message.rs index 150e7a0..1bef326 100644 --- a/src/jingle_message.rs +++ b/src/jingle_message.rs @@ -121,6 +121,13 @@ impl From for Element { mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(JingleMI, 68); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(JingleMI, 136); diff --git a/src/jingle_s5b.rs b/src/jingle_s5b.rs index a5fdff0..904a4d7 100644 --- a/src/jingle_s5b.rs +++ b/src/jingle_s5b.rs @@ -277,6 +277,19 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Type, 1); + assert_size!(Mode, 1); + assert_size!(CandidateId, 12); + assert_size!(StreamId, 12); + assert_size!(Candidate, 80); + assert_size!(TransportPayload, 16); + assert_size!(Transport, 44); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Type, 1); diff --git a/src/mam.rs b/src/mam.rs index 4456412..819bc46 100644 --- a/src/mam.rs +++ b/src/mam.rs @@ -191,6 +191,19 @@ mod tests { use super::*; use std::str::FromStr; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(QueryId, 12); + assert_size!(Query, 116); + assert_size!(Result_, 228); + assert_size!(Complete, 1); + assert_size!(Fin, 44); + assert_size!(DefaultPrefs, 1); + assert_size!(Prefs, 28); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(QueryId, 24); diff --git a/src/media_element.rs b/src/media_element.rs index 722780f..dc0c2af 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -51,6 +51,14 @@ mod tests { use data_forms::DataForm; use std::error::Error as StdError; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(URI, 24); + assert_size!(MediaElement, 28); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(URI, 48); diff --git a/src/message.rs b/src/message.rs index 2e9d9c6..9c392b7 100644 --- a/src/message.rs +++ b/src/message.rs @@ -234,6 +234,17 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(MessageType, 1); + assert_size!(Body, 12); + assert_size!(Subject, 12); + assert_size!(Thread, 12); + assert_size!(Message, 136); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(MessageType, 1); diff --git a/src/message_correct.rs b/src/message_correct.rs index e8233ee..06b433f 100644 --- a/src/message_correct.rs +++ b/src/message_correct.rs @@ -25,6 +25,13 @@ mod tests { use minidom::Element; use error::Error; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Replace, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Replace, 24); diff --git a/src/mood.rs b/src/mood.rs index 6bf8bd2..5920432 100644 --- a/src/mood.rs +++ b/src/mood.rs @@ -272,6 +272,14 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(MoodEnum, 1); + assert_size!(Text, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(MoodEnum, 1); diff --git a/src/nick.rs b/src/nick.rs index 2d2f90c..7a36665 100644 --- a/src/nick.rs +++ b/src/nick.rs @@ -16,6 +16,13 @@ mod tests { use minidom::Element; use error::Error; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Nick, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Nick, 24); diff --git a/src/presence.rs b/src/presence.rs index 02a9a9c..db6ac7a 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -323,6 +323,15 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Show, 1); + assert_size!(Type, 1); + assert_size!(Presence, 112); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Show, 1); diff --git a/src/receipts.rs b/src/receipts.rs index ecf0a21..49759c7 100644 --- a/src/receipts.rs +++ b/src/receipts.rs @@ -33,6 +33,14 @@ mod tests { use minidom::Element; use ns; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Request, 0); + assert_size!(Received, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Request, 0); diff --git a/src/roster.rs b/src/roster.rs index eeebddf..c1f8641 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -85,6 +85,16 @@ mod tests { use std::str::FromStr; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Group, 12); + assert_size!(Subscription, 1); + assert_size!(Item, 64); + assert_size!(Roster, 24); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Group, 24); diff --git a/src/rsm.rs b/src/rsm.rs index 2f17693..fb321fa 100644 --- a/src/rsm.rs +++ b/src/rsm.rs @@ -158,6 +158,14 @@ mod tests { use super::*; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(SetQuery, 40); + assert_size!(SetResult, 40); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(SetQuery, 80); diff --git a/src/sasl.rs b/src/sasl.rs index 5272fd0..1ec44af 100644 --- a/src/sasl.rs +++ b/src/sasl.rs @@ -215,6 +215,20 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Mechanism, 1); + assert_size!(Auth, 16); + assert_size!(Challenge, 12); + assert_size!(Response, 12); + assert_size!(Abort, 0); + assert_size!(Success, 12); + assert_size!(DefinedCondition, 1); + assert_size!(Failure, 16); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Mechanism, 1); diff --git a/src/sm.rs b/src/sm.rs index dfc3dff..404b54e 100644 --- a/src/sm.rs +++ b/src/sm.rs @@ -144,6 +144,22 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(A, 4); + assert_size!(ResumeAttr, 1); + assert_size!(Enable, 12); + assert_size!(StreamId, 12); + assert_size!(Enabled, 36); + assert_size!(Failed, 12); + assert_size!(R, 0); + assert_size!(Resume, 16); + assert_size!(Resumed, 16); + assert_size!(StreamManagement, 0); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(A, 4); diff --git a/src/stanza_error.rs b/src/stanza_error.rs index 480b1d8..750823d 100644 --- a/src/stanza_error.rs +++ b/src/stanza_error.rs @@ -289,6 +289,15 @@ impl From for Element { mod tests { use super::*; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(ErrorType, 1); + assert_size!(DefinedCondition, 1); + assert_size!(StanzaError, 104); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(ErrorType, 1); diff --git a/src/stanza_id.rs b/src/stanza_id.rs index 9dc3698..e45b528 100644 --- a/src/stanza_id.rs +++ b/src/stanza_id.rs @@ -42,6 +42,14 @@ mod tests { use error::Error; use std::str::FromStr; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(StanzaId, 48); + assert_size!(OriginId, 12); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(StanzaId, 96); diff --git a/src/stream.rs b/src/stream.rs index b81ba77..ad8ec4f 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -76,6 +76,13 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Stream, 108); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Stream, 216); diff --git a/src/version.rs b/src/version.rs index 7ed8974..cbd9583 100644 --- a/src/version.rs +++ b/src/version.rs @@ -43,6 +43,14 @@ mod tests { use minidom::Element; use compare_elements::NamespaceAwareCompare; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(VersionQuery, 0); + assert_size!(VersionResult, 36); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(VersionQuery, 0); diff --git a/src/websocket.rs b/src/websocket.rs index 2f87437..f2d28eb 100644 --- a/src/websocket.rs +++ b/src/websocket.rs @@ -75,6 +75,13 @@ mod tests { use try_from::TryFrom; use minidom::Element; + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(Open, 108); + } + + #[cfg(target_pointer_width = "64")] #[test] fn test_size() { assert_size!(Open, 216);