summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/suites/test_chunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/tests/suites/test_chunk.c')
-rw-r--r--src/libstrongswan/tests/suites/test_chunk.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/libstrongswan/tests/suites/test_chunk.c b/src/libstrongswan/tests/suites/test_chunk.c
index 6272ca795..b82b1436f 100644
--- a/src/libstrongswan/tests/suites/test_chunk.c
+++ b/src/libstrongswan/tests/suites/test_chunk.c
@@ -316,11 +316,11 @@ START_TEST(test_chunk_skip)
foobar = chunk_from_str("foobar");
a = foobar;
a = chunk_skip(a, 0);
- ck_assert(chunk_equals(a, foobar));
+ ck_assert_chunk_eq(a, foobar);
a = chunk_skip(a, 1);
- ck_assert(chunk_equals(a, chunk_from_str("oobar")));
+ ck_assert_chunk_eq(a, chunk_from_str("oobar"));
a = chunk_skip(a, 2);
- ck_assert(chunk_equals(a, chunk_from_str("bar")));
+ ck_assert_chunk_eq(a, chunk_from_str("bar"));
a = chunk_skip(a, 3);
assert_chunk_empty(a);
@@ -338,20 +338,24 @@ START_TEST(test_chunk_skip_zero)
{
chunk_t foobar, a;
- a = chunk_empty;
- a = chunk_skip_zero(a);
+ a = chunk_skip_zero(chunk_empty);
assert_chunk_empty(a);
foobar = chunk_from_str("foobar");
- a = foobar;
- a = chunk_skip_zero(a);
- ck_assert(chunk_equals(a, foobar));
+ a = chunk_skip_zero(foobar);
+ ck_assert_chunk_eq(a, foobar);
- a = chunk_from_chars(0x00, 0xaa, 0xbb, 0xcc);
- a = chunk_skip_zero(a);
- ck_assert(chunk_equals(a, chunk_from_chars(0xaa, 0xbb, 0xcc)));
+ foobar = chunk_from_chars(0x00);
+ a = chunk_skip_zero(foobar);
+ ck_assert_chunk_eq(a, foobar);
+
+ a = chunk_skip_zero(chunk_from_chars(0x00, 0xaa, 0xbb, 0xcc));
+ ck_assert_chunk_eq(a, chunk_from_chars(0xaa, 0xbb, 0xcc));
a = chunk_skip_zero(a);
- ck_assert(chunk_equals(a, chunk_from_chars(0xaa, 0xbb, 0xcc)));
+ ck_assert_chunk_eq(a, chunk_from_chars(0xaa, 0xbb, 0xcc));
+
+ a = chunk_skip_zero(chunk_from_chars(0x00, 0x00, 0xaa, 0xbb, 0xcc));
+ ck_assert_chunk_eq(a, chunk_from_chars(0xaa, 0xbb, 0xcc));
}
END_TEST
@@ -736,7 +740,7 @@ START_TEST(test_chunk_mac)
{
chunk_t in;
u_char key[16];
- u_int64_t out;
+ uint64_t out;
int i, count;
count = countof(sip_vectors);
@@ -765,7 +769,7 @@ END_TEST
START_TEST(test_chunk_hash)
{
chunk_t chunk;
- u_int32_t hash_a, hash_b, hash_c;
+ uint32_t hash_a, hash_b, hash_c;
chunk = chunk_from_str("asdf");
@@ -787,7 +791,7 @@ END_TEST
START_TEST(test_chunk_hash_static)
{
chunk_t in;
- u_int32_t out, hash_a, hash_b, hash_inc = 0x7b891a95;
+ uint32_t out, hash_a, hash_b, hash_inc = 0x7b891a95;
int i, count;
count = countof(sip_vectors);
@@ -813,7 +817,7 @@ END_TEST
* test for chunk_internet_checksum[_inc]()
*/
-static inline u_int16_t compensate_alignment(u_int16_t val)
+static inline uint16_t compensate_alignment(uint16_t val)
{
return ((val & 0xff) << 8) | (val >> 8);
}
@@ -821,7 +825,7 @@ static inline u_int16_t compensate_alignment(u_int16_t val)
START_TEST(test_chunk_internet_checksum)
{
chunk_t chunk;
- u_int16_t sum;
+ uint16_t sum;
chunk = chunk_from_chars(0x45,0x00,0x00,0x30,0x44,0x22,0x40,0x00,0x80,0x06,
0x00,0x00,0x8c,0x7c,0x19,0xac,0xae,0x24,0x1e,0x2b);