diff options
| author | Marvin W <git@larma.de> | 2025-04-07 14:09:57 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2025-04-07 14:11:05 +0200 |
| commit | 7dc815ac4d196f01ce76fc5e61ef13b02dace15e (patch) | |
| tree | b3686ce21c11288d350782c6fbb80924c4ce194e /xmpp-vala/tests/stanza.vala | |
| parent | db1830c54ecc70f7933febab02c2ad7ee44d0bd1 (diff) | |
Fix unexpected behavior of get_attribute_uint on systems with 32-bit long
Diffstat (limited to 'xmpp-vala/tests/stanza.vala')
| -rw-r--r-- | xmpp-vala/tests/stanza.vala | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/xmpp-vala/tests/stanza.vala b/xmpp-vala/tests/stanza.vala index fa1ccb41..7326a668 100644 --- a/xmpp-vala/tests/stanza.vala +++ b/xmpp-vala/tests/stanza.vala @@ -115,20 +115,24 @@ class StanzaTest : Gee.TestCase { private void test_get_attribute_int() { var stanza_node = new StanzaNode.build("test", "ns").add_self_xmlns().put_attribute("bar", "42"); - assert(stanza_node.get_attribute_int("bar", -2) == 42); - assert(stanza_node.get_attribute_uint("bar", 3) == 42); + fail_if_not_eq_int(stanza_node.get_attribute_int("bar", -2), 42); + fail_if_not_eq_uint(stanza_node.get_attribute_uint("bar", 3), 42); stanza_node = new StanzaNode.build("test", "ns").add_self_xmlns().put_attribute("bar", "-42"); - assert(stanza_node.get_attribute_int("bar", -2) == -42); - assert(stanza_node.get_attribute_uint("bar", 3) == 3); + fail_if_not_eq_int(stanza_node.get_attribute_int("bar", -2), -42); + fail_if_not_eq_uint(stanza_node.get_attribute_uint("bar", 3), 3); stanza_node = new StanzaNode.build("test", "ns").add_self_xmlns(); - assert(stanza_node.get_attribute_int("bar", -2) == -2); - assert(stanza_node.get_attribute_uint("bar", 3) == 3); + fail_if_not_eq_int(stanza_node.get_attribute_int("bar", -2), -2); + fail_if_not_eq_uint(stanza_node.get_attribute_uint("bar", 3), 3); + + stanza_node = new StanzaNode.build("test", "ns").add_self_xmlns().put_attribute("bar", "0x42"); + fail_if_not_eq_int(stanza_node.get_attribute_int("bar", -2), -2); + fail_if_not_eq_uint(stanza_node.get_attribute_uint("bar", 3), 3); stanza_node = new StanzaNode.build("test", "ns").add_self_xmlns().put_attribute("bar", "str"); - assert(stanza_node.get_attribute_int("bar", -2) == -2); - assert(stanza_node.get_attribute_uint("bar", 3) == 3); + fail_if_not_eq_int(stanza_node.get_attribute_int("bar", -2), -2); + fail_if_not_eq_uint(stanza_node.get_attribute_uint("bar", 3), 3); } |
