1162852Sdes/*
2162852Sdes * Copyright (c) 2005 Darren Tucker
3162852Sdes *
4162852Sdes * Permission to use, copy, modify, and distribute this software for any
5162852Sdes * purpose with or without fee is hereby granted, provided that the above
6162852Sdes * copyright notice and this permission notice appear in all copies.
7162852Sdes *
8162852Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9162852Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10162852Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11162852Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12162852Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13162852Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14162852Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15162852Sdes */
16162852Sdes
17162852Sdes#include <stdlib.h>
18162852Sdes#include <string.h>
19162852Sdes
20162852Sdesstatic int fail = 0;
21162852Sdes
22162852Sdesvoid
23162852Sdestest(const char *a)
24162852Sdes{
25162852Sdes	char *b;
26162852Sdes
27162852Sdes	b = strdup(a);
28162852Sdes	if (b == 0) {
29162852Sdes		fail = 1;
30162852Sdes		return;
31162852Sdes	}
32162852Sdes	if (strcmp(a, b) != 0)
33162852Sdes		fail = 1;
34162852Sdes	free(b);
35162852Sdes}
36162852Sdes
37162852Sdesint
38162852Sdesmain(void)
39162852Sdes{
40162852Sdes	test("");
41162852Sdes	test("a");
42162852Sdes	test("\0");
43162852Sdes	test("abcdefghijklmnopqrstuvwxyz");
44162852Sdes	return fail;
45162852Sdes}
46