Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / isc / tests / print_test.c
blobea78c94771af7d55b27b8602820e5e1c76c40a89
1 /* $NetBSD: print_test.c,v 1.1.1.4 2015/07/08 15:38:05 christos Exp $ */
3 /*
4 * Copyright (C) 2014, 2015 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>
29 * Workout if we need to force the inclusion of print.c so we can test
30 * it on all platforms even if we don't include it in libisc.
32 #include <isc/platform.h>
33 #if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && !defined(ISC_PLATFORM_NEEDSPRINTF)
34 #define ISC__PRINT_SOURCE
35 #include "../print.c"
36 #else
37 #if !defined(ISC_PLATFORM_NEEDVSNPRINTF) || !defined(ISC_PLATFORM_NEEDSPRINTF)
38 #define ISC__PRINT_SOURCE
39 #endif
40 #include <isc/print.h>
41 #include <isc/types.h>
42 #include <isc/util.h>
43 #endif
45 ATF_TC(snprintf);
46 ATF_TC_HEAD(snprintf, tc) {
47 atf_tc_set_md_var(tc, "descr", "snprintf implementation");
49 ATF_TC_BODY(snprintf, tc) {
50 char buf[10000];
51 isc_uint64_t ll = 8589934592ULL;
52 int n;
54 UNUSED(tc);
57 * 4294967296 <= 8589934592 < 1000000000^2 to verify fix for
58 * RT#36505.
61 memset(buf, 0xff, sizeof(buf));
62 n = isc_print_snprintf(buf, sizeof(buf), "%qu", ll);
63 ATF_CHECK_EQ(n, 10);
64 ATF_CHECK_STREQ(buf, "8589934592");
66 memset(buf, 0xff, sizeof(buf));
67 n = isc_print_snprintf(buf, sizeof(buf), "%llu", ll);
68 ATF_CHECK_EQ(n, 10);
69 ATF_CHECK_STREQ(buf, "8589934592");
73 * Main
75 ATF_TP_ADD_TCS(tp) {
76 ATF_TP_ADD_TC(tp, snprintf);
77 return (atf_no_error());