diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-06-07 11:13:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-06-07 11:13:39 +0200 |
commit | a849538e3bf0097595fc1fd86bcda608d1151b4c (patch) | |
tree | 20e5dbc1399719e7e24ac6997adf2428a8cdce51 /src/test/test-unaligned.c | |
parent | 82e4eda664d40ef60829e27d84b1610c2f4070cd (diff) | |
parent | 1e7a0e21c97ac1bbc743009e5ec8c12bc6200e19 (diff) |
Merge pull request #3394 from poettering/triple-tstamp
timestamping improvements and IPv6 RA revamp
Diffstat (limited to 'src/test/test-unaligned.c')
-rw-r--r-- | src/test/test-unaligned.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/test-unaligned.c b/src/test/test-unaligned.c index b18b3fca0e..4f64398943 100644 --- a/src/test/test-unaligned.c +++ b/src/test/test-unaligned.c @@ -159,7 +159,31 @@ static void test_le(void) { assert_se(memcmp(&scratch[7], &data[7], sizeof(uint64_t)) == 0); } +static void test_ne(void) { + uint16_t x = 4711; + uint32_t y = 123456; + uint64_t z = 9876543210; + + /* Note that we don't bother actually testing alignment issues in this function, after all the _ne() functions + * are just aliases for the _le() or _be() implementations, which we test extensively above. Hence, in this + * function, just ensure that they map to the right version on the local architecture. */ + + assert_se(unaligned_read_ne16(&x) == 4711); + assert_se(unaligned_read_ne32(&y) == 123456); + assert_se(unaligned_read_ne64(&z) == 9876543210); + + unaligned_write_ne16(&x, 1); + unaligned_write_ne32(&y, 2); + unaligned_write_ne64(&z, 3); + + assert_se(x == 1); + assert_se(y == 2); + assert_se(z == 3); +} + int main(int argc, const char *argv[]) { test_be(); test_le(); + test_ne(); + return 0; } |