xref: /illumos-gate/usr/src/cmd/sendmail/libsm/t-strrevcmp.c (revision dd72704bd9e794056c558153663c739e2012d721)
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 #include <sm/gen.h>
11 SM_IDSTR(id, "@(#)$Id: t-strrevcmp.c,v 1.1 2001/07/16 21:35:28 ca Exp $")
12 
13 #include <sm/exc.h>
14 #include <sm/io.h>
15 #include <sm/string.h>
16 #include <sm/test.h>
17 
18 int
19 main(argc, argv)
20 	int argc;
21 	char **argv;
22 {
23 	char *s1;
24 	char *s2;
25 
26 	sm_test_begin(argc, argv, "test string compare");
27 
28 	s1 = "equal";
29 	s2 = "equal";
30 	SM_TEST(sm_strrevcmp(s1, s2) == 0);
31 
32 	s1 = "equal";
33 	s2 = "qual";
34 	SM_TEST(sm_strrevcmp(s1, s2) > 0);
35 
36 	s1 = "qual";
37 	s2 = "equal";
38 	SM_TEST(sm_strrevcmp(s1, s2) < 0);
39 
40 	s1 = "Equal";
41 	s2 = "equal";
42 	SM_TEST(sm_strrevcmp(s1, s2) < 0);
43 
44 	s1 = "Equal";
45 	s2 = "equal";
46 	SM_TEST(sm_strrevcasecmp(s1, s2) == 0);
47 
48 	s1 = "Equal";
49 	s2 = "eQuaL";
50 	SM_TEST(sm_strrevcasecmp(s1, s2) == 0);
51 
52 	return sm_test_end();
53 }
54