diff options
Diffstat (limited to 'epan/oids_test.c')
-rw-r--r-- | epan/oids_test.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/epan/oids_test.c b/epan/oids_test.c index 59373150..4c57f2d0 100644 --- a/epan/oids_test.c +++ b/epan/oids_test.c @@ -25,29 +25,29 @@ static wmem_allocator_t *test_scope; typedef struct { - const gchar *string; - const gchar *resolved; - guint encoded_len; - const guint8 *encoded; - guint subids_len; - guint32 subids[]; + const char *string; + const char *resolved; + unsigned encoded_len; + const uint8_t *encoded; + unsigned subids_len; + uint32_t subids[]; } example_s; DIAG_OFF_PEDANTIC -example_s ex1 = {"2.1.1", "joint-iso-itu-t.1.1", 2, (const guint8 *)"\x51\x01", 3, {2,1,1} }; -example_s ex2rel = {".81.1", ".81.1", 2, (const guint8*)"\x51\x01", 2, {81,1} }; +example_s ex1 = {"2.1.1", "joint-iso-itu-t.1.1", 2, (const uint8_t *)"\x51\x01", 3, {2,1,1} }; +example_s ex2rel = {".81.1", ".81.1", 2, (const uint8_t*)"\x51\x01", 2, {81,1} }; example_s ex3 = {"2.1.127.16383.2097151.268435455.128.16384.2097152.268435456", "joint-iso-itu-t.1.127.16383.2097151.268435455.128.16384.2097152.268435456", - 25, (const guint8*)"\x51\x7f\xff\x7f\xff\xff\x7f\xff\xff\xff\x7f\x81\x00\x81\x80\x00\x81\x80\x80\x00\x81\x80\x80\x80\x00", + 25, (const uint8_t*)"\x51\x7f\xff\x7f\xff\xff\x7f\xff\xff\xff\x7f\x81\x00\x81\x80\x00\x81\x80\x80\x00\x81\x80\x80\x80\x00", 10, { 2, 1, 0x7F, 0x3FFF, 0x1FFFFF, 0x0FFFFFFF, 1+0x7F, 1+0x3FFF, 1+0x1FFFFF, 1+0x0FFFFFFF} }; -example_s ex4 = {"2.1", "joint-iso-itu-t.1", 1, (const guint8*)"\x51", 2, {2,1} }; +example_s ex4 = {"2.1", "joint-iso-itu-t.1", 1, (const uint8_t*)"\x51", 2, {2,1} }; example_s ex5 = {"2", "joint-iso-itu-t", 0, NULL, 1, {2} }; example_s ex6rel = {".81.127.16383.2097151.268435455.128.16384.2097152.268435456", ".81.127.16383.2097151.268435455.128.16384.2097152.268435456", - 25, (const guint8*)"\x51\x7f\xff\x7f\xff\xff\x7f\xff\xff\xff\x7f\x81\x00\x81\x80\x00\x81\x80\x80\x00\x81\x80\x80\x80\x00", + 25, (const uint8_t*)"\x51\x7f\xff\x7f\xff\xff\x7f\xff\xff\xff\x7f\x81\x00\x81\x80\x00\x81\x80\x80\x00\x81\x80\x80\x80\x00", 9, { 81, 0x7F, 0x3FFF, 0x1FFFFF, 0x0FFFFFFF, 1+0x7F, 1+0x3FFF, 1+0x1FFFFF, 1+0x0FFFFFFF} }; -example_s ex7 = {"2.1.1", "joint-iso-itu-t.asn1.basic-encoding", 2, (const guint8*)"\x51\x01", 3, {2,1,1} }; +example_s ex7 = {"2.1.1", "joint-iso-itu-t.asn1.basic-encoding", 2, (const uint8_t*)"\x51\x01", 3, {2,1,1} }; DIAG_ON_PEDANTIC /* @@ -70,9 +70,9 @@ DIAG_ON_PEDANTIC static void oids_test_2subids_encoded(void) { - guint32 *subids = NULL; - guint len; - guint i; + uint32_t *subids = NULL; + unsigned len; + unsigned i; len = oid_encoded2subid(NULL, ex1.encoded, ex1.encoded_len, &subids); g_assert_true(len == ex1.subids_len); @@ -84,9 +84,9 @@ oids_test_2subids_encoded(void) static void oids_test_2subids_encoded_long(void) { - guint32 *subids = NULL; - guint len; - guint i; + uint32_t *subids = NULL; + unsigned len; + unsigned i; len = oid_encoded2subid(NULL, ex3.encoded, ex3.encoded_len, &subids); g_assert_true(len == ex3.subids_len); @@ -98,11 +98,11 @@ oids_test_2subids_encoded_long(void) static void oids_test_2subids_encoded_absviasub(void) { - guint32 *subids = NULL; - guint len; - guint i; + uint32_t *subids = NULL; + unsigned len; + unsigned i; - len = oid_encoded2subid_sub(NULL, ex1.encoded, ex1.encoded_len, &subids, TRUE); + len = oid_encoded2subid_sub(NULL, ex1.encoded, ex1.encoded_len, &subids, true); g_assert_true(len == ex1.subids_len); for (i=0; i < len; i++) g_assert_true(subids[i] == ex1.subids[i]); @@ -112,11 +112,11 @@ oids_test_2subids_encoded_absviasub(void) static void oids_test_2subids_encoded_relviasub(void) { - guint32 *subids = NULL; - guint len; - guint i; + uint32_t *subids = NULL; + unsigned len; + unsigned i; - len = oid_encoded2subid_sub(NULL, ex2rel.encoded, ex2rel.encoded_len, &subids, FALSE); + len = oid_encoded2subid_sub(NULL, ex2rel.encoded, ex2rel.encoded_len, &subids, false); g_assert_true(len == ex2rel.subids_len); for (i=0; i < len; i++) g_assert_true(subids[i] == ex2rel.subids[i]); @@ -126,8 +126,8 @@ oids_test_2subids_encoded_relviasub(void) static void oids_test_2subids_string(void) { - guint32 *subids = NULL; - guint len, i; + uint32_t *subids = NULL; + unsigned len, i; len = oid_string2subid(test_scope, ex1.string, &subids); g_assert_true(len == ex1.subids_len); @@ -138,8 +138,8 @@ oids_test_2subids_string(void) static void oids_test_2subids_string_tooshort(void) { - guint32 *subids = NULL; - guint len, i; + uint32_t *subids = NULL; + unsigned len, i; len = oid_string2subid(test_scope, ex5.string, &subids); g_assert_true(len == ex5.subids_len); @@ -152,8 +152,8 @@ oids_test_2subids_string_tooshort(void) static void oids_test_2encoded_string_simple(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_string2encoded(NULL, ex1.string, &encoded); g_assert_true(len == ex1.encoded_len); @@ -164,8 +164,8 @@ oids_test_2encoded_string_simple(void) static void oids_test_2encoded_string_short(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_string2encoded(NULL, ex4.string, &encoded); g_assert_true(len == ex4.encoded_len); @@ -176,8 +176,8 @@ oids_test_2encoded_string_short(void) static void oids_test_2encoded_string_long(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_string2encoded(NULL, ex3.string, &encoded); g_assert_true(len == ex3.encoded_len); @@ -188,8 +188,8 @@ oids_test_2encoded_string_long(void) static void oids_test_2encoded_string_tooshort(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_string2encoded(NULL, ex5.string, &encoded); g_assert_true(len == ex5.encoded_len); @@ -200,8 +200,8 @@ oids_test_2encoded_string_tooshort(void) static void oids_test_2encoded_subids_simple(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_subid2encoded(NULL, ex1.subids_len, ex1.subids, &encoded); g_assert_true(len == ex1.encoded_len); @@ -212,8 +212,8 @@ oids_test_2encoded_subids_simple(void) static void oids_test_2encoded_subids_bad(void) { - guint8 *encoded = NULL; - guint len; + uint8_t *encoded = NULL; + unsigned len; len = oid_subid2encoded(NULL, ex5.subids_len, ex5.subids, &encoded); g_assert_true(len == ex5.encoded_len); @@ -226,7 +226,7 @@ oids_test_2encoded_subids_bad(void) static void oids_test_2string_encoded(void) { - gchar* oid; + char* oid; oid = oid_encoded2string(NULL, ex3.encoded, ex3.encoded_len); g_assert_cmpstr(oid, ==, ex3.string); @@ -236,7 +236,7 @@ oids_test_2string_encoded(void) static void oids_test_2string_encoded_rel(void) { - gchar* oid; + char* oid; oid = rel_oid_encoded2string(NULL, ex6rel.encoded, ex3.encoded_len); g_assert_cmpstr(oid, ==, ex6rel.string); @@ -247,7 +247,7 @@ oids_test_2string_encoded_rel(void) static void oids_test_2string_subids_abs(void) { - gchar* oid; + char* oid; oid = oid_subid2string(NULL, ex1.subids, ex1.subids_len); g_assert_cmpstr(oid, ==, ex1.string); @@ -257,9 +257,9 @@ oids_test_2string_subids_abs(void) static void oids_test_2string_subids_rel(void) { - gchar* oid; + char* oid; - oid = rel_oid_subid2string(NULL, ex2rel.subids, ex2rel.subids_len, FALSE); + oid = rel_oid_subid2string(NULL, ex2rel.subids, ex2rel.subids_len, false); g_assert_cmpstr(oid, ==, ex2rel.string); wmem_free(NULL, oid); } @@ -267,9 +267,9 @@ oids_test_2string_subids_rel(void) static void oids_test_2string_subids_absviarel(void) { - gchar* oid; + char* oid; - oid = rel_oid_subid2string(NULL, ex1.subids, ex1.subids_len, TRUE); + oid = rel_oid_subid2string(NULL, ex1.subids, ex1.subids_len, true); g_assert_cmpstr(oid, ==, ex1.string); wmem_free(NULL, oid); } @@ -277,9 +277,9 @@ oids_test_2string_subids_absviarel(void) static void oids_test_2string_subids_relsizes(void) { - gchar* oid; + char* oid; - oid = rel_oid_subid2string(NULL, ex6rel.subids, ex6rel.subids_len, FALSE); + oid = rel_oid_subid2string(NULL, ex6rel.subids, ex6rel.subids_len, false); g_assert_cmpstr(oid, ==, ex6rel.string); wmem_free(NULL, oid); } @@ -289,7 +289,7 @@ oids_test_2string_subids_relsizes(void) static void oids_test_2resolved_subids(void) { - gchar* oid; + char* oid; oid = oid_resolved(NULL, ex1.subids_len, ex1.subids); g_assert_cmpstr(oid, ==, ex1.resolved); @@ -299,7 +299,7 @@ oids_test_2resolved_subids(void) static void oids_test_2resolved_encoded(void) { - gchar* oid; + char* oid; oid = oid_resolved_from_encoded(NULL, ex1.encoded, ex1.encoded_len); g_assert_cmpstr(oid, ==, ex1.resolved); @@ -309,7 +309,7 @@ oids_test_2resolved_encoded(void) static void oids_test_2resolved_encoded_rel(void) { - gchar* oid; + char* oid; oid = rel_oid_resolved_from_encoded(NULL, ex2rel.encoded, ex2rel.encoded_len); g_assert_cmpstr(oid, ==, ex2rel.string); @@ -319,7 +319,7 @@ oids_test_2resolved_encoded_rel(void) static void oids_test_2resolved_string(void) { - gchar* oid; + char* oid; oid = oid_resolved_from_string(NULL, ex1.string); g_assert_cmpstr(oid, ==, ex1.resolved); @@ -331,8 +331,8 @@ oids_test_2resolved_string(void) static void oids_test_2both_subids(void) { - gchar* resolved; - gchar* oid; + char* resolved; + char* oid; oid_both(NULL, ex1.subids_len, ex1.subids, &resolved, &oid); g_assert_cmpstr(resolved, ==, ex1.resolved); @@ -344,8 +344,8 @@ oids_test_2both_subids(void) static void oids_test_2both_encoded(void) { - gchar* resolved; - gchar* oid; + char* resolved; + char* oid; oid_both_from_encoded(NULL, ex1.encoded, ex1.encoded_len, &resolved, &oid); g_assert_cmpstr(resolved, ==, ex1.resolved); @@ -357,8 +357,8 @@ oids_test_2both_encoded(void) static void oids_test_2both_string(void) { - gchar* resolved; - gchar* oid; + char* resolved; + char* oid; oid_both_from_string(NULL, ex1.string, &resolved, &oid); g_assert_cmpstr(resolved, ==, ex1.resolved); @@ -372,8 +372,8 @@ oids_test_2both_string(void) static void oids_test_2struct_subids(void) { - guint matched; - guint left; + unsigned matched; + unsigned left; oid_info_t *st; st = oid_get(ex1.subids_len, ex1.subids, &matched, &left); @@ -386,11 +386,11 @@ oids_test_2struct_subids(void) static void oids_test_2struct_encoded(void) { - guint matched; - guint left; - guint32 *subids = NULL; + unsigned matched; + unsigned left; + uint32_t *subids = NULL; oid_info_t *st; - guint len, i; + unsigned len, i; st = oid_get_from_encoded(NULL, ex1.encoded, ex1.encoded_len, &subids, &matched, &left); g_assert_true(matched == 1); @@ -407,11 +407,11 @@ oids_test_2struct_encoded(void) static void oids_test_2struct_string(void) { - guint matched; - guint left; - guint32 *subids; + unsigned matched; + unsigned left; + uint32_t *subids; oid_info_t *st; - guint len, i; + unsigned len, i; st = oid_get_from_string(test_scope, ex1.string, &subids, &matched, &left); g_assert_true(matched == 1); @@ -427,7 +427,7 @@ oids_test_2struct_string(void) static void oids_test_add_subids(void) { - gchar* oid; + char* oid; oid_add(ex7.resolved, ex7.subids_len, ex7.subids); oid = oid_resolved(NULL, ex7.subids_len, ex7.subids); @@ -438,7 +438,7 @@ oids_test_add_subids(void) static void oids_test_add_encoded(void) { - gchar* oid; + char* oid; oid_add_from_encoded(ex7.resolved, ex7.encoded, ex7.encoded_len); oid = oid_resolved(NULL, ex7.subids_len, ex7.subids); @@ -449,7 +449,7 @@ oids_test_add_encoded(void) static void oids_test_add_string(void) { - gchar* oid; + char* oid; oid_add_from_string(ex7.resolved, ex7.string); oid = oid_resolved(NULL, ex7.subids_len, ex7.subids); |