diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:27 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-02-05 08:38:27 +0100 |
commit | 14d771b90f5a7d3887e5e900d1fb4737477ad305 (patch) | |
tree | f382e3359d20916ae60d28361e59635e373224f8 /libqcdm/tests/test-qcdm-result.c | |
parent | a09050a7f63a262bf90dcb1c7a41f9cfd205db43 (diff) |
Imported Upstream version 0.5.2.0upstream/0.5.2.0
Diffstat (limited to 'libqcdm/tests/test-qcdm-result.c')
-rw-r--r-- | libqcdm/tests/test-qcdm-result.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/libqcdm/tests/test-qcdm-result.c b/libqcdm/tests/test-qcdm-result.c index 87f264b..0a1820d 100644 --- a/libqcdm/tests/test-qcdm-result.c +++ b/libqcdm/tests/test-qcdm-result.c @@ -29,7 +29,7 @@ test_result_string (void *f, void *data) { const char *str = "foobarblahblahblah"; const char *tmp = NULL; - QCDMResult *result; + QcdmResult *result; result = qcdm_result_new (); qcdm_result_add_string (result, TEST_TAG, str); @@ -46,13 +46,13 @@ test_result_uint32 (void *f, void *data) { guint32 num = 0xDEADBEEF; guint32 tmp = 0; - QCDMResult *result; + QcdmResult *result; result = qcdm_result_new (); - qcdm_result_add_uint32 (result, TEST_TAG, num); + qcdm_result_add_u32 (result, TEST_TAG, num); - qcdm_result_get_uint32 (result, TEST_TAG, &tmp); - g_assert (tmp == num); + qcdm_result_get_u32 (result, TEST_TAG, &tmp); + g_assert_cmpint (tmp, ==, num); } void @@ -60,12 +60,28 @@ test_result_uint8 (void *f, void *data) { guint8 num = 0x1E; guint8 tmp = 0; - QCDMResult *result; + QcdmResult *result; result = qcdm_result_new (); - qcdm_result_add_uint8 (result, TEST_TAG, num); + qcdm_result_add_u8 (result, TEST_TAG, num); - qcdm_result_get_uint8 (result, TEST_TAG, &tmp); + qcdm_result_get_u8 (result, TEST_TAG, &tmp); g_assert (tmp == num); } +void +test_result_uint8_array (void *f, void *data) +{ + u_int8_t array[] = { 0, 1, 255, 32, 128, 127 }; + const u_int8_t *tmp = NULL; + size_t tmp_len = 0; + QcdmResult *result; + + result = qcdm_result_new (); + qcdm_result_add_u8_array (result, TEST_TAG, array, sizeof (array)); + + qcdm_result_get_u8_array (result, TEST_TAG, &tmp, &tmp_len); + g_assert_cmpint (tmp_len, ==, sizeof (array)); + g_assert_cmpint (memcmp (tmp, array, tmp_len), ==, 0); +} + |