1 /***********************************************************************
2  *                                                                      *
3  *               This software is part of the ast package               *
4  *          Copyright (c) 1982-2011 AT&T Intellectual Property          *
5  *                      and is licensed under the                       *
6  *                 Eclipse Public License, Version 1.0                  *
7  *                    by AT&T Intellectual Property                     *
8  *                                                                      *
9  *                A copy of the License is available at                 *
10  *          http://www.eclipse.org/org/documents/epl-v10.html           *
11  *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12  *                                                                      *
13  *              Information and Software Systems Research               *
14  *                            AT&T Research                             *
15  *                           Florham Park NJ                            *
16  *                                                                      *
17  *                    David Korn <dgkorn@gmail.com>                     *
18  *                                                                      *
19  ***********************************************************************/
20 //
21 // UNIX shell
22 // David Korn
23 // AT&T Labs
24 //
25 #ifndef _TEST_H
26 #define _TEST_H 1
27 
28 #include "shell.h"
29 
30 //
31 // These are the valid test operators.
32 //
33 #define TEST_ARITH 040     // arithmetic operators
34 #define TEST_BINOP 0200    // binary operator
35 #define TEST_PATTERN 0100  // turn off bit for pattern compares
36 
37 #define TEST_NE (TEST_ARITH | 9)
38 #define TEST_EQ (TEST_ARITH | 4)
39 #define TEST_GE (TEST_ARITH | 5)
40 #define TEST_GT (TEST_ARITH | 6)
41 #define TEST_LE (TEST_ARITH | 7)
42 #define TEST_LT (TEST_ARITH | 8)
43 #define TEST_OR (TEST_BINOP | 1)
44 #define TEST_AND (TEST_BINOP | 2)
45 #define TEST_SNE (TEST_PATTERN | 1)
46 #define TEST_SEQ (TEST_PATTERN | 14)
47 #define TEST_PNE 1
48 #define TEST_PEQ 14
49 #define TEST_EF 3
50 #define TEST_NT 10
51 #define TEST_OT 12
52 #define TEST_SLT 16
53 #define TEST_SGT 17
54 #define TEST_END 8
55 #define TEST_REP 20
56 
57 extern int test_unop(Shell_t *, int, const char *);
58 extern int test_inode(const char *, const char *);
59 extern int test_binop(Shell_t *, int, const char *, const char *);
60 
61 extern const char *test_opchars;
62 extern const char *e_argument;
63 extern const char *e_missing;
64 extern const char *e_badop;
65 extern const char *e_test_no_pattern;
66 extern const char *e_op_unhandled;
67 extern const char *e_tstbegin;
68 extern const char *e_tstend;
69 
70 #endif  // _TEST_H
71