Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / lwres / tests / config_test.c
blobd7163f48dbb85aefb8c80d6ef03f40c2c19b1f95
1 /* $NetBSD: config_test.c,v 1.1.1.3 2014/12/10 03:34:46 christos Exp $ */
3 /*
4 * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
19 #include <config.h>
21 #include <atf-c.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <unistd.h>
28 #include "../lwconfig.c"
30 static void
31 setup_test() {
33 * atf-run changes us to a /tmp directory, so tests
34 * that access test data files must first chdir to the proper
35 * location.
37 ATF_CHECK(chdir(TESTS) != -1);
40 ATF_TC(parse_linklocal);
41 ATF_TC_HEAD(parse_linklocal, tc) {
42 atf_tc_set_md_var(tc, "descr", "lwres_conf_parse link-local nameserver");
44 ATF_TC_BODY(parse_linklocal, tc) {
45 lwres_result_t result;
46 lwres_context_t *ctx = NULL;
47 unsigned char addr[16] = { 0xfe, 0x80, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x01 };
52 UNUSED(tc);
54 setup_test();
56 lwres_context_create(&ctx, NULL, NULL, NULL,
57 LWRES_CONTEXT_USEIPV4 | LWRES_CONTEXT_USEIPV6);
58 ATF_CHECK_EQ(ctx->confdata.nsnext, 0);
59 ATF_CHECK_EQ(ctx->confdata.nameservers[0].zone, 0);
61 result = lwres_conf_parse(ctx, "testdata/link-local.conf");
62 ATF_CHECK_EQ(result, LWRES_R_SUCCESS);
63 ATF_CHECK_EQ(ctx->confdata.nsnext, 1);
64 ATF_CHECK_EQ(ctx->confdata.nameservers[0].zone, 1);
65 ATF_CHECK_EQ(memcmp(ctx->confdata.nameservers[0].address, addr, 16), 0);
66 lwres_context_destroy(&ctx);
70 * Main
72 ATF_TP_ADD_TCS(tp) {
73 ATF_TP_ADD_TC(tp, parse_linklocal);
74 return (atf_no_error());