summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2020-02-28 00:00:00 +0000
committerzugz (tox) <mbays+tox@sdf.org>2020-03-14 00:00:02 +0000
commitc644ef76810f8db61bce3f52d36a1a6a25e47683 (patch)
tree1a4c5ed13f1a3450e3a005746ba6bb0d1af7beaf /auto_tests
parente6714909898d7e5fe6b35b6d109e584e6c5858b0 (diff)
use -1 rather than ~0 in unsigned integer types
Using ~0 involves a bitwise operation on int, so depends on the internal representation of signed integers.
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/toxav_basic_test.c4
-rw-r--r--auto_tests/toxav_many_test.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c
index 5c6daefa..89c2918a 100644
--- a/auto_tests/toxav_basic_test.c
+++ b/auto_tests/toxav_basic_test.c
@@ -88,7 +88,7 @@ static void t_accept_friend_request_cb(Tox *m, const uint8_t *public_key, const
88 void *userdata) 88 void *userdata)
89{ 89{
90 if (length == 7 && memcmp("gentoo", data, 7) == 0) { 90 if (length == 7 && memcmp("gentoo", data, 7) == 0) {
91 ck_assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t) ~0); 91 ck_assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t) -1);
92 } 92 }
93} 93}
94 94
@@ -191,7 +191,7 @@ static void test_av_flows(void)
191 tox_bootstrap(Alice, "localhost", dht_port, dht_key, nullptr); 191 tox_bootstrap(Alice, "localhost", dht_port, dht_key, nullptr);
192 tox_bootstrap(Bob, "localhost", dht_port, dht_key, nullptr); 192 tox_bootstrap(Bob, "localhost", dht_port, dht_key, nullptr);
193 193
194 ck_assert(tox_friend_add(Bob, address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) ~0); 194 ck_assert(tox_friend_add(Bob, address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) -1);
195 195
196 uint8_t off = 1; 196 uint8_t off = 1;
197 197
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c
index c8b14022..76417366 100644
--- a/auto_tests/toxav_many_test.c
+++ b/auto_tests/toxav_many_test.c
@@ -72,7 +72,7 @@ static void t_accept_friend_request_cb(Tox *m, const uint8_t *public_key, const
72 void *userdata) 72 void *userdata)
73{ 73{
74 if (length == 7 && memcmp("gentoo", data, 7) == 0) { 74 if (length == 7 && memcmp("gentoo", data, 7) == 0) {
75 ck_assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t) ~0); 75 ck_assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t) -1);
76 } 76 }
77} 77}
78 78
@@ -180,9 +180,9 @@ static void test_av_three_calls(void)
180 tox_bootstrap(Bobs[1], "localhost", dht_port, dht_key, nullptr); 180 tox_bootstrap(Bobs[1], "localhost", dht_port, dht_key, nullptr);
181 tox_bootstrap(Bobs[2], "localhost", dht_port, dht_key, nullptr); 181 tox_bootstrap(Bobs[2], "localhost", dht_port, dht_key, nullptr);
182 182
183 ck_assert(tox_friend_add(Bobs[0], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) ~0); 183 ck_assert(tox_friend_add(Bobs[0], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) -1);
184 ck_assert(tox_friend_add(Bobs[1], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) ~0); 184 ck_assert(tox_friend_add(Bobs[1], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) -1);
185 ck_assert(tox_friend_add(Bobs[2], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) ~0); 185 ck_assert(tox_friend_add(Bobs[2], address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) -1);
186 186
187 uint8_t off = 1; 187 uint8_t off = 1;
188 188