mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Test struct sizes on 32-bit too.
This commit is contained in:
parent
40aedcf184
commit
7a2dcbee01
37 changed files with 338 additions and 0 deletions
|
@ -98,6 +98,13 @@ impl From<Bind> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -268,6 +268,17 @@ impl From<DataForm> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
14
src/disco.rs
14
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
10
src/ibb.rs
10
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -533,6 +533,22 @@ impl From<Jingle> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -121,6 +121,13 @@ impl From<JingleMI> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
13
src/mam.rs
13
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
14
src/sasl.rs
14
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);
|
||||
|
|
16
src/sm.rs
16
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);
|
||||
|
|
|
@ -289,6 +289,15 @@ impl From<StanzaError> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue