diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2023-07-23 12:15:34 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-04-12 10:21:20 +0200 |
| commit | 47d4780eb448f839fc6b0644135395f879080ba4 (patch) | |
| tree | 2c9a84bf45a4b8af5411331db50173fc5a34f630 /test/routing.c | |
| parent | 3515701479fe04f73e9194ee3074457bb85030f6 (diff) | |
I don't remember
Diffstat (limited to 'test/routing.c')
| -rw-r--r-- | test/routing.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/routing.c b/test/routing.c index ad6f2c3..4613848 100644 --- a/test/routing.c +++ b/test/routing.c @@ -1,7 +1,9 @@ #include "unity.h" #include "routing.h" -#define IP(a, b, c, d) (a << 24 | b << 16 | c << 8 | d) +#include <arpa/inet.h> + +#define IP(a, b, c, d) htonl(a << 24 | b << 16 | c << 8 | d) struct nodeid self; @@ -229,7 +231,7 @@ void test_close_to_self_load_factor() { // Make a nodeid that is one bit different struct nodeid new = self; - new.inner[4] += 1; + new.inner[4] += ntohl(1); struct entry* entry; TEST_ASSERT_TRUE_MESSAGE(routing_offer(&new, &entry), "Did not accept new entry"); @@ -260,7 +262,7 @@ void test_far_from_self_load_factor() { struct nodeid new = self; // Flip top bit to make it very dissimilar - new.inner[0] ^= 0x80000000; + new.inner[0] ^= ntohl(0x80000000); struct entry* entry; TEST_ASSERT_TRUE_MESSAGE(routing_offer(&new, &entry), "Did not accept new entry"); |
