xref: /titanic_44/usr/src/cmd/sendmail/libsm/t-strrevcmp.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  */
9 
10 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 
12 #include <sm/gen.h>
13 SM_IDSTR(id, "@(#)$Id: t-strrevcmp.c,v 1.1 2001/07/16 21:35:28 ca Exp $")
14 
15 #include <sm/exc.h>
16 #include <sm/io.h>
17 #include <sm/string.h>
18 #include <sm/test.h>
19 
20 int
21 main(argc, argv)
22 	int argc;
23 	char **argv;
24 {
25 	char *s1;
26 	char *s2;
27 
28 	sm_test_begin(argc, argv, "test string compare");
29 
30 	s1 = "equal";
31 	s2 = "equal";
32 	SM_TEST(sm_strrevcmp(s1, s2) == 0);
33 
34 	s1 = "equal";
35 	s2 = "qual";
36 	SM_TEST(sm_strrevcmp(s1, s2) > 0);
37 
38 	s1 = "qual";
39 	s2 = "equal";
40 	SM_TEST(sm_strrevcmp(s1, s2) < 0);
41 
42 	s1 = "Equal";
43 	s2 = "equal";
44 	SM_TEST(sm_strrevcmp(s1, s2) < 0);
45 
46 	s1 = "Equal";
47 	s2 = "equal";
48 	SM_TEST(sm_strrevcasecmp(s1, s2) == 0);
49 
50 	s1 = "Equal";
51 	s2 = "eQuaL";
52 	SM_TEST(sm_strrevcasecmp(s1, s2) == 0);
53 
54 	return sm_test_end();
55 }
56