aboutsummaryrefslogtreecommitdiff
path: root/lib/roken/parse_bytes-test.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-06-26 22:56:52 +0000
committerCy Schubert <cy@FreeBSD.org>2023-06-26 22:56:52 +0000
commitb6a943f7197af1a5eb6bb028b9b808ec5016e30c (patch)
treecfbb91e940dd89d0e1d46095f43c228d7d079fa0 /lib/roken/parse_bytes-test.c
parent6f4e10db3298f6d65e1e646fe52aaafc3682b788 (diff)
Heimdal 7.8.0 does not support OpenSSL 3.0. 7.9.0 will but it hasn't been released yet. We are importing f62e2f278 for its OpenSSL 3.0 support.
Diffstat (limited to 'lib/roken/parse_bytes-test.c')
-rw-r--r--lib/roken/parse_bytes-test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/roken/parse_bytes-test.c b/lib/roken/parse_bytes-test.c
index 87f2fa8984aa..8f3831cbb08f 100644
--- a/lib/roken/parse_bytes-test.c
+++ b/lib/roken/parse_bytes-test.c
@@ -38,7 +38,7 @@
static struct testcase {
int canonicalp;
- int val;
+ int64_t val;
const char *def_unit;
const char *str;
} tests[] = {
@@ -52,6 +52,7 @@ static struct testcase {
{1, 1024 * 1024, NULL, "1 megabyte"},
{0, 1025, NULL, "1 kilobyte 1"},
{1, 1025, NULL, "1 kilobyte 1 byte"},
+ {1, 1024ULL * 1024 * 1024 * 1024, NULL, "1 terabyte"},
};
int
@@ -62,20 +63,20 @@ main(int argc, char **argv)
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) {
char buf[256];
- int val = parse_bytes (tests[i].str, tests[i].def_unit);
+ int64_t val = parse_bytes (tests[i].str, tests[i].def_unit);
if (val != tests[i].val) {
- printf ("parse_bytes (%s, %s) = %d != %d\n",
+ printf ("parse_bytes (%s, %s) = %lld != %lld\n",
tests[i].str,
tests[i].def_unit ? tests[i].def_unit : "none",
- val, tests[i].val);
+ (long long)val, (long long)tests[i].val);
++ret;
}
if (tests[i].canonicalp) {
(void) unparse_bytes (tests[i].val, buf, sizeof(buf));
if (strcmp (tests[i].str, buf) != 0) {
- printf ("unparse_bytes (%d) = \"%s\" != \"%s\"\n",
- tests[i].val, buf, tests[i].str);
+ printf ("unparse_bytes (%lld) = \"%s\" != \"%s\"\n",
+ (long long)tests[i].val, buf, tests[i].str);
++ret;
}
}