Commit 41add8ff authored by Pekka Pessi's avatar Pekka Pessi
Browse files

test_sresolv.v: added more tests for A6 record parsing.

darcs-hash:20060504190244-65a35-4dd5bba8bf222de6f49780704ba19ec610a0a175.gz
parent 7813c0f8
......@@ -44,9 +44,13 @@ _sips._udp SRV 3 100 5061 sip00
sip CNAME sip00
subnet A6 0 3ff0:00::
labnet A6 23 0000:0012:3012:: subnet
a6 A6 48 ::c006:0a08:20ff:fe7d:e7ac labnet
subnet A6 0 3ff0:0::
labnet A6 23 0:12:3012:: subnet
sublab A6 48 0:0:0:c006:: labnet
mynet A6 56 0:0:0:c006:: sublab
a6 A6 64 ::0a08:20ff:fe7d:e7ac mynet
alias6 A6 128 a6
full A6 0 3ff0:12:3012:c006:0a08:20ff:fe7d:e7ac
sip00 A 194.2.188.133
AAAA 3ff0:0010:3012:c000:02c0:95ff:fee2:4b78
......
......@@ -528,6 +528,7 @@ int test_a(sres_context_t *ctx)
TEST_RUN(ctx);
TEST_1(result = ctx->result);
TEST_1(result[0]);
TEST(result[0]->sr_record->r_status, 0);
TEST_1(rr_a = result[0]->sr_a);
TEST(rr_a->a_record->r_type, sres_type_a);
......@@ -679,13 +680,44 @@ int test_a6_prefix(sres_context_t *ctx)
TEST(rr_a6->a6_record->r_type, sres_type_a6);
TEST(rr_a6->a6_record->r_class, sres_class_in);
TEST(rr_a6->a6_record->r_ttl, 60);
TEST(rr_a6->a6_prelen, 48);
TEST(rr_a6->a6_prelen, 64);
TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
"::a08:20ff:fe7d:e7ac");
TEST_S(rr_a6->a6_prename, "mynet.example.com.");
sres_free_answers(res, ctx->result), ctx->result = NULL;
/* Check parsing of special case: no prefix */
TEST_1(sres_query(res, test_answer, ctx, sres_type_a6, "full.example.com"));
TEST_RUN(ctx);
TEST_1(result = ctx->result);
TEST_1(rr_a6 = result[0]->sr_a6);
TEST(rr_a6->a6_record->r_type, sres_type_a6);
TEST(rr_a6->a6_record->r_class, sres_class_in);
TEST(rr_a6->a6_record->r_ttl, 60);
TEST(rr_a6->a6_prelen, 0);
TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
"::c006:a08:20ff:fe7d:e7ac");
"3ff0:12:3012:c006:a08:20ff:fe7d:e7ac");
TEST(rr_a6->a6_prename, NULL);
sres_free_answers(res, ctx->result), ctx->result = NULL;
TEST_S(rr_a6->a6_prename, "labnet.example.com.");
/* Check parsing of special case: no suffix */
TEST_1(sres_query(res, test_answer, ctx, sres_type_a6, "alias6.example.com"));
TEST_RUN(ctx);
TEST_1(result = ctx->result);
TEST_1(rr_a6 = result[0]->sr_a6);
TEST(rr_a6->a6_record->r_type, sres_type_a6);
TEST(rr_a6->a6_record->r_class, sres_class_in);
TEST(rr_a6->a6_record->r_ttl, 60);
TEST(rr_a6->a6_prelen, 128);
TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
TEST_S(rr_a6->a6_prename, "a6.example.com.");
sres_free_answers(res, ctx->result), ctx->result = NULL;
TEST_1(result = sres_cached_answers(res, sres_type_a6, domain));
......@@ -694,12 +726,12 @@ int test_a6_prefix(sres_context_t *ctx)
TEST(rr_a6->a6_record->r_type, sres_type_a6);
TEST(rr_a6->a6_record->r_class, sres_class_in);
TEST(rr_a6->a6_record->r_ttl, 60);
TEST(rr_a6->a6_prelen, 48);
TEST(rr_a6->a6_prelen, 64);
TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
"::c006:a08:20ff:fe7d:e7ac");
"::a08:20ff:fe7d:e7ac");
TEST_S(rr_a6->a6_prename, "labnet.example.com.");
TEST_S(rr_a6->a6_prename, "mynet.example.com.");
sres_free_answers(res, result), result = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment