The first a bug in pax and should be commited to FBSD, too.
[dragonfly.git] / contrib / gperf / tests / jstest3.gperf
1 struct js_keyword {
2   const char * name;
3   int token;
4 }
5 %%
6 abstract, 1
7 boolean, 2
8 break, 3
9 byte, 4
10 case, 5
11 catch, 6
12 char, 7
13 class, 8
14 const, 9
15 continue, 10
16 default, 11
17 do, 12
18 double, 13
19 else, 14
20 extends, 15
21 false, 16
22 final, 17
23 finally, 18
24 float, 19
25 for, 20
26 function, 21
27 goto, 22
28 if, 23
29 implements, 24
30 import, 25
31 in, 26
32 instanceof, 27
33 int, 28
34 interface, 29
35 long, 30
36 native, 31
37 new, 32
38 null, 33
39 package, 34
40 private, 35
41 protected, 36
42 public, 37
43 return, 38
44 short, 39
45 static, 40
46 super, 41
47 switch, 42
48 synchronized, 43
49 this, 44
50 throw, 45
51 throws, 46
52 transient, 47
53 true, 48
54 try, 49
55 var, 50
56 void, 51
57 while, 52
58 with, 53
59 %%
60 #include <stdlib.h>
61 #include <string.h>
62 #if defined(__STDC__) || defined(__cplusplus)
63 #define CONST const
64 #else
65 #define CONST
66 #endif
67 static CONST char* testdata[] = {
68   "bogus",
69   "abstract",
70   "boolean",
71   "break",
72   "byte",
73   "case",
74   "catch",
75   "char",
76   "class",
77   "const",
78   "continue",
79   "default",
80   "do",
81   "double",
82   "else",
83   "extends",
84   "false",
85   "final",
86   "finally",
87   "float",
88   "for",
89   "function",
90   "goto",
91   "if",
92   "implements",
93   "import",
94   "in",
95   "instanceof",
96   "int",
97   "interface",
98   "long",
99   "native",
100   "new",
101   "null",
102   "package",
103   "private",
104   "protected",
105   "public",
106   "return",
107   "short",
108   "static",
109   "super",
110   "switch",
111   "synchronized",
112   "this",
113   "throw",
114   "throws",
115   "transient",
116   "true",
117   "try",
118   "var",
119   "void",
120   "while",
121   "with"
122 };
123 int main ()
124 {
125   int i;
126   for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++)
127     {
128 #ifdef CPLUSPLUS_TEST
129       CONST struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i]));
130 #else
131       CONST struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i]));
132 #endif
133       if (i > 0)
134         {
135           if (!resword)
136             exit (1);
137           if (strcmp(testdata[i],resword->name))
138             exit (1);
139         }
140       else
141         {
142           if (resword)
143             exit (1);
144         }
145     }
146   return 0;
147 }