1 /* $NetBSD: print_test.c,v 1.1.1.4 2015/07/08 15:38:05 christos Exp $ */
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.
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
37 #if !defined(ISC_PLATFORM_NEEDVSNPRINTF) || !defined(ISC_PLATFORM_NEEDSPRINTF)
38 #define ISC__PRINT_SOURCE
40 #include <isc/print.h>
41 #include <isc/types.h>
46 ATF_TC_HEAD(snprintf
, tc
) {
47 atf_tc_set_md_var(tc
, "descr", "snprintf implementation");
49 ATF_TC_BODY(snprintf
, tc
) {
51 isc_uint64_t ll
= 8589934592ULL;
57 * 4294967296 <= 8589934592 < 1000000000^2 to verify fix for
61 memset(buf
, 0xff, sizeof(buf
));
62 n
= isc_print_snprintf(buf
, sizeof(buf
), "%qu", ll
);
64 ATF_CHECK_STREQ(buf
, "8589934592");
66 memset(buf
, 0xff, sizeof(buf
));
67 n
= isc_print_snprintf(buf
, sizeof(buf
), "%llu", ll
);
69 ATF_CHECK_STREQ(buf
, "8589934592");
76 ATF_TP_ADD_TC(tp
, snprintf
);
77 return (atf_no_error());