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