From eb8dd9dca1228af0cd132f515509051ecfabf6f6 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Mon, 14 Apr 2025 17:32:06 +0000 Subject: This commit was manufactured by cvs2git to create tag 'tb_20250414'. --- src/regress/lib/libc/strtol/Makefile | 5 -- src/regress/lib/libc/strtol/strtoltest.c | 81 -------------------------------- 2 files changed, 86 deletions(-) delete mode 100644 src/regress/lib/libc/strtol/Makefile delete mode 100644 src/regress/lib/libc/strtol/strtoltest.c (limited to 'src/regress/lib/libc/strtol') diff --git a/src/regress/lib/libc/strtol/Makefile b/src/regress/lib/libc/strtol/Makefile deleted file mode 100644 index 3e2f4c746d..0000000000 --- a/src/regress/lib/libc/strtol/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2012/11/18 04:11:09 jsing Exp $ - -PROG= strtoltest - -.include diff --git a/src/regress/lib/libc/strtol/strtoltest.c b/src/regress/lib/libc/strtol/strtoltest.c deleted file mode 100644 index 2efd7b3ad1..0000000000 --- a/src/regress/lib/libc/strtol/strtoltest.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $OpenBSD: strtoltest.c,v 1.4 2017/07/15 17:08:26 jsing Exp $ */ -/* - * Copyright (c) 2012 Joel Sing - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -struct strtol_test { - char *input; - long output; - char end; - int base; - int err; -}; - -struct strtol_test strtol_tests[] = { - {"1234567890", 1234567890L, '\0', 0, 0}, - {"0755", 493L, '\0', 0, 0}, - {"0x7fFFffFf", 2147483647L, '\0', 0, 0}, - {"1234567890", 0L, '1', 1, EINVAL}, - {"10101010", 170L, '\0', 2, 0}, - {"755", 493L, '\0', 8, 0}, - {"1234567890", 1234567890L, '\0', 10, 0}, - {"abc", 0L, 'a', 10, 0}, - {"123xyz", 123L, 'x', 10, 0}, - {"-080000000", -2147483648L, '\0', 16, 0}, - {"deadbeefdeadbeef", LONG_MAX, '\0', 16, ERANGE}, - {"deadzbeef", 57005L, 'z', 16, 0}, - {"0xy", 0L, 'x', 16, 0}, - {"-quitebigmchuge", LONG_MIN, '\0', 32, ERANGE}, - {"zzz", 46655L, '\0', 36, 0}, - {"1234567890", 0L, '1', 37, EINVAL}, - {"1234567890", 0L, '1', 123, EINVAL}, -}; - -int -main(int argc, char **argv) -{ - struct strtol_test *test; - int failure = 0; - char *end; - u_int i; - long n; - - for (i = 0; i < (sizeof(strtol_tests) / sizeof(strtol_tests[0])); i++) { - test = &strtol_tests[i]; - errno = 0; - n = strtol(test->input, &end, test->base); - if (n != test->output) { - fprintf(stderr, "TEST %i FAILED: %s base %i: %li\n", - i, test->input, test->base, n); - failure = 1; - } else if (*end != test->end) { - fprintf(stderr, "TEST %i FAILED: end is not %c: %c\n", - i, test->end, *end); - failure = 1; - } else if (errno != test->err) { - fprintf(stderr, "TEST %i FAILED: errno is not %i: %i\n", - i, test->err, errno); - failure = 1; - } - } - - return failure; -} -- cgit v1.2.3-55-g6feb