summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/assoc_test.c12
-rw-r--r--auto_tests/dht_test.c10
2 files changed, 11 insertions, 11 deletions
diff --git a/auto_tests/assoc_test.c b/auto_tests/assoc_test.c
index 9de95136..165724e9 100644
--- a/auto_tests/assoc_test.c
+++ b/auto_tests/assoc_test.c
@@ -18,7 +18,7 @@
18START_TEST(test_basics) 18START_TEST(test_basics)
19{ 19{
20 /* TODO: real test */ 20 /* TODO: real test */
21 uint8_t id[CLIENT_ID_SIZE]; 21 uint8_t id[crypto_box_PUBLICKEYBYTES];
22 Assoc *assoc = new_Assoc_default(id); 22 Assoc *assoc = new_Assoc_default(id);
23 ck_assert_msg(assoc != NULL, "failed to create default assoc"); 23 ck_assert_msg(assoc != NULL, "failed to create default assoc");
24 24
@@ -63,19 +63,19 @@ START_TEST(test_fillup)
63{ 63{
64 /* TODO: real test */ 64 /* TODO: real test */
65 int i, j; 65 int i, j;
66 uint8_t id[CLIENT_ID_SIZE]; 66 uint8_t id[crypto_box_PUBLICKEYBYTES];
67 //uint32_t a = current_time(); 67 //uint32_t a = current_time();
68 uint32_t a = 2710106197; 68 uint32_t a = 2710106197;
69 srand(a); 69 srand(a);
70 70
71 for (i = 0; i < CLIENT_ID_SIZE; ++i) { 71 for (i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) {
72 id[i] = rand(); 72 id[i] = rand();
73 } 73 }
74 74
75 Assoc *assoc = new_Assoc(6, 15, id); 75 Assoc *assoc = new_Assoc(6, 15, id);
76 ck_assert_msg(assoc != NULL, "failed to create default assoc"); 76 ck_assert_msg(assoc != NULL, "failed to create default assoc");
77 struct entry { 77 struct entry {
78 uint8_t id[CLIENT_ID_SIZE]; 78 uint8_t id[crypto_box_PUBLICKEYBYTES];
79 IPPTs ippts_send; 79 IPPTs ippts_send;
80 IP_Port ipp_recv; 80 IP_Port ipp_recv;
81 }; 81 };
@@ -85,7 +85,7 @@ START_TEST(test_fillup)
85 85
86 for (j = 0; j < 128; ++j) { 86 for (j = 0; j < 128; ++j) {
87 87
88 for (i = 0; i < CLIENT_ID_SIZE; ++i) { 88 for (i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) {
89 entries[j].id[i] = rand(); 89 entries[j].id[i] = rand();
90 } 90 }
91 91
@@ -100,7 +100,7 @@ START_TEST(test_fillup)
100 entries[j].ipp_recv = ipp; 100 entries[j].ipp_recv = ipp;
101 101
102 if (j % 16 == 0) { 102 if (j % 16 == 0) {
103 memcpy(entries[j].id, id, CLIENT_ID_SIZE - 30); 103 memcpy(entries[j].id, id, crypto_box_PUBLICKEYBYTES - 30);
104 memcpy(&closest[j / 16], &entries[j], sizeof(struct entry)); 104 memcpy(&closest[j / 16], &entries[j], sizeof(struct entry));
105 105
106 } 106 }
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c
index 479eb330..32985bca 100644
--- a/auto_tests/dht_test.c
+++ b/auto_tests/dht_test.c
@@ -85,7 +85,7 @@ void test_addto_lists_update(DHT *dht,
85{ 85{
86 int used, test, test1, test2, found; 86 int used, test, test1, test2, found;
87 IP_Port test_ipp; 87 IP_Port test_ipp;
88 uint8_t test_id[CLIENT_ID_SIZE]; 88 uint8_t test_id[crypto_box_PUBLICKEYBYTES];
89 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0; 89 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0;
90 90
91 // check id update for existing ip_port 91 // check id update for existing ip_port
@@ -153,7 +153,7 @@ void test_addto_lists_bad(DHT *dht,
153{ 153{
154 // check "bad" clients replacement 154 // check "bad" clients replacement
155 int used, test1, test2, test3; 155 int used, test1, test2, test3;
156 uint8_t public_key[CLIENT_ID_SIZE], test_id1[CLIENT_ID_SIZE], test_id2[CLIENT_ID_SIZE], test_id3[CLIENT_ID_SIZE]; 156 uint8_t public_key[crypto_box_PUBLICKEYBYTES], test_id1[crypto_box_PUBLICKEYBYTES], test_id2[crypto_box_PUBLICKEYBYTES], test_id3[crypto_box_PUBLICKEYBYTES];
157 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0; 157 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0;
158 158
159 randombytes(public_key, sizeof(public_key)); 159 randombytes(public_key, sizeof(public_key));
@@ -196,7 +196,7 @@ void test_addto_lists_possible_bad(DHT *dht,
196{ 196{
197 // check "possibly bad" clients replacement 197 // check "possibly bad" clients replacement
198 int used, test1, test2, test3; 198 int used, test1, test2, test3;
199 uint8_t public_key[CLIENT_ID_SIZE], test_id1[CLIENT_ID_SIZE], test_id2[CLIENT_ID_SIZE], test_id3[CLIENT_ID_SIZE]; 199 uint8_t public_key[crypto_box_PUBLICKEYBYTES], test_id1[crypto_box_PUBLICKEYBYTES], test_id2[crypto_box_PUBLICKEYBYTES], test_id3[crypto_box_PUBLICKEYBYTES];
200 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0; 200 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0;
201 201
202 randombytes(public_key, sizeof(public_key)); 202 randombytes(public_key, sizeof(public_key));
@@ -258,7 +258,7 @@ void test_addto_lists_good(DHT *dht,
258 IP_Port *ip_port, 258 IP_Port *ip_port,
259 const uint8_t *comp_client_id) 259 const uint8_t *comp_client_id)
260{ 260{
261 uint8_t public_key[CLIENT_ID_SIZE]; 261 uint8_t public_key[crypto_box_PUBLICKEYBYTES];
262 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0; 262 uint8_t ipv6 = ip_port->ip.family == AF_INET6 ? 1 : 0;
263 263
264 mark_all_good(list, length, ipv6); 264 mark_all_good(list, length, ipv6);
@@ -291,7 +291,7 @@ void test_addto_lists(IP ip)
291 ck_assert_msg(dht != 0, "Failed to create DHT"); 291 ck_assert_msg(dht != 0, "Failed to create DHT");
292 292
293 IP_Port ip_port = { .ip = ip, .port = TOX_PORT_DEFAULT }; 293 IP_Port ip_port = { .ip = ip, .port = TOX_PORT_DEFAULT };
294 uint8_t public_key[CLIENT_ID_SIZE]; 294 uint8_t public_key[crypto_box_PUBLICKEYBYTES];
295 int i, used; 295 int i, used;
296 296
297 // check lists filling 297 // check lists filling