From 4881c371cef5e3c1065d7dfa314fffc3a5ab0256 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 19 Feb 2006 22:50:20 +1100 Subject: - (dtucker) [Makefile.in configure.ac, added openbsd-compat/regress/] Add first attempt at regress tests for compat library. ok djm@ --- openbsd-compat/regress/strduptest.c | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 openbsd-compat/regress/strduptest.c (limited to 'openbsd-compat/regress/strduptest.c') diff --git a/openbsd-compat/regress/strduptest.c b/openbsd-compat/regress/strduptest.c new file mode 100644 index 000000000..664a48ef4 --- /dev/null +++ b/openbsd-compat/regress/strduptest.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2005 Darren Tucker + * + * 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. + */ + +static int fail = 0; + +void +test(const char *a) +{ + char *b; + + b = strdup(a); + if (b == 0) { + fail = 1; + return; + } + if (strcmp(a, b) != 0) + fail = 1; + free(b); +} + +int +main(void) +{ + test(""); + test("a"); + test("\0"); + test("abcdefghijklmnopqrstuvwxyz"); + return fail; +} -- cgit v1.2.3 From d04db59ad929d289c2dcaa466989659bbc449f6b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sat, 5 Aug 2006 13:27:29 +1000 Subject: - (djm) [openbsd-compat/regress/snprintftest.c] [openbsd-compat/regress/strduptest.c] Add missing includes so they pass compilation with "-Wall -Werror" --- ChangeLog | 5 ++++- openbsd-compat/regress/snprintftest.c | 1 + openbsd-compat/regress/strduptest.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'openbsd-compat/regress/strduptest.c') diff --git a/ChangeLog b/ChangeLog index 47069e286..180f4403b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,9 @@ remove last traces of bufaux.h - it was merged into buffer.h in the big includes.h commit - (djm) [auth.c loginrec.c] Missing netinet/in.h for loginrec + - (djm) [openbsd-compat/regress/snprintftest.c] + [openbsd-compat/regress/strduptest.c] Add missing includes so they pass + compilation with "-Wall -Werror" 20060804 - (dtucker) [configure.ac] The "crippled AES" test does not work on recent @@ -5160,4 +5163,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.4456 2006/08/05 02:54:24 djm Exp $ +$Id: ChangeLog,v 1.4457 2006/08/05 03:27:29 djm Exp $ diff --git a/openbsd-compat/regress/snprintftest.c b/openbsd-compat/regress/snprintftest.c index e25bf223f..8879244b5 100644 --- a/openbsd-compat/regress/snprintftest.c +++ b/openbsd-compat/regress/snprintftest.c @@ -21,6 +21,7 @@ #include #include #include +#include static int failed = 0; diff --git a/openbsd-compat/regress/strduptest.c b/openbsd-compat/regress/strduptest.c index 664a48ef4..7f6d779be 100644 --- a/openbsd-compat/regress/strduptest.c +++ b/openbsd-compat/regress/strduptest.c @@ -14,6 +14,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include +#include + static int fail = 0; void -- cgit v1.2.3