1*23f24377SWarner Loshecho T.int-expr: test interval expressions
2*23f24377SWarner Losh
3*23f24377SWarner Loshawk=${awk-../a.out}
4*23f24377SWarner Losh
5*23f24377SWarner Loshrm -f foo
6*23f24377SWarner Losh
7*23f24377SWarner Loshcat << \EOF > prog
8*23f24377SWarner LoshNF == 0		{ next }
9*23f24377SWarner Losh$1 == "pat"	{ pattern = $2; next }
10*23f24377SWarner Losh{
11*23f24377SWarner Losh	check = ($1 ~ pattern)
12*23f24377SWarner Losh	printf("%s ~ /%s/ -> should be %d, is %d\n", $1, pattern, $2, check)
13*23f24377SWarner Losh}
14*23f24377SWarner LoshEOF
15*23f24377SWarner Losh
16*23f24377SWarner Loshcat << \EOF > foo.in
17*23f24377SWarner Loshpat	ab{0}c
18*23f24377SWarner Loshac	1
19*23f24377SWarner Loshabc	0
20*23f24377SWarner Losh
21*23f24377SWarner Loshpat	a(b{0})c
22*23f24377SWarner Loshac	1
23*23f24377SWarner Loshabc	0
24*23f24377SWarner Losh
25*23f24377SWarner Loshpat	ab{0}*c
26*23f24377SWarner Loshac	1
27*23f24377SWarner Loshabc	0
28*23f24377SWarner Losh
29*23f24377SWarner Loshpat	a(b{0})*c
30*23f24377SWarner Loshac	1
31*23f24377SWarner Loshabc	0
32*23f24377SWarner Losh
33*23f24377SWarner Loshpat	ab{0,}c
34*23f24377SWarner Loshac	1
35*23f24377SWarner Loshabc	1
36*23f24377SWarner Losh
37*23f24377SWarner Loshpat	a(b{0,})c
38*23f24377SWarner Loshac	1
39*23f24377SWarner Loshabc	1
40*23f24377SWarner Losh
41*23f24377SWarner Loshpat	ab{0,}*c
42*23f24377SWarner Loshac	1
43*23f24377SWarner Loshabc	1
44*23f24377SWarner Losh
45*23f24377SWarner Loshpat	a(b{0,})*c
46*23f24377SWarner Loshac	1
47*23f24377SWarner Loshabc	1
48*23f24377SWarner Losh
49*23f24377SWarner Loshpat	ab{1}c
50*23f24377SWarner Loshac	0
51*23f24377SWarner Loshabc	1
52*23f24377SWarner Loshabbc	0
53*23f24377SWarner Losh
54*23f24377SWarner Loshpat	ab{1,}c
55*23f24377SWarner Loshac	0
56*23f24377SWarner Loshabc	1
57*23f24377SWarner Loshabbc	1
58*23f24377SWarner Loshabbbc	1
59*23f24377SWarner Loshabbbbc	1
60*23f24377SWarner Losh
61*23f24377SWarner Loshpat	ab{0,1}c
62*23f24377SWarner Loshac	1
63*23f24377SWarner Loshabc	1
64*23f24377SWarner Loshabbc	0
65*23f24377SWarner Losh
66*23f24377SWarner Loshpat	ab{0,3}c
67*23f24377SWarner Loshac	1
68*23f24377SWarner Loshabc	1
69*23f24377SWarner Loshabbc	1
70*23f24377SWarner Loshabbbc	1
71*23f24377SWarner Loshabbbbc	0
72*23f24377SWarner Losh
73*23f24377SWarner Loshpat	ab{1,3}c
74*23f24377SWarner Loshac	0
75*23f24377SWarner Loshabc	1
76*23f24377SWarner Loshabbc	1
77*23f24377SWarner Loshabbbc	1
78*23f24377SWarner Loshabbbbc	0
79*23f24377SWarner LoshEOF
80*23f24377SWarner Losh
81*23f24377SWarner Loshcat << \EOF > foo1
82*23f24377SWarner Loshac ~ /ab{0}c/ -> should be 1, is 1
83*23f24377SWarner Loshabc ~ /ab{0}c/ -> should be 0, is 0
84*23f24377SWarner Loshac ~ /a(b{0})c/ -> should be 1, is 1
85*23f24377SWarner Loshabc ~ /a(b{0})c/ -> should be 0, is 0
86*23f24377SWarner Loshac ~ /ab{0}*c/ -> should be 1, is 1
87*23f24377SWarner Loshabc ~ /ab{0}*c/ -> should be 0, is 0
88*23f24377SWarner Loshac ~ /a(b{0})*c/ -> should be 1, is 1
89*23f24377SWarner Loshabc ~ /a(b{0})*c/ -> should be 0, is 0
90*23f24377SWarner Loshac ~ /ab{0,}c/ -> should be 1, is 1
91*23f24377SWarner Loshabc ~ /ab{0,}c/ -> should be 1, is 1
92*23f24377SWarner Loshac ~ /a(b{0,})c/ -> should be 1, is 1
93*23f24377SWarner Loshabc ~ /a(b{0,})c/ -> should be 1, is 1
94*23f24377SWarner Loshac ~ /ab{0,}*c/ -> should be 1, is 1
95*23f24377SWarner Loshabc ~ /ab{0,}*c/ -> should be 1, is 1
96*23f24377SWarner Loshac ~ /a(b{0,})*c/ -> should be 1, is 1
97*23f24377SWarner Loshabc ~ /a(b{0,})*c/ -> should be 1, is 1
98*23f24377SWarner Loshac ~ /ab{1}c/ -> should be 0, is 0
99*23f24377SWarner Loshabc ~ /ab{1}c/ -> should be 1, is 1
100*23f24377SWarner Loshabbc ~ /ab{1}c/ -> should be 0, is 0
101*23f24377SWarner Loshac ~ /ab{1,}c/ -> should be 0, is 0
102*23f24377SWarner Loshabc ~ /ab{1,}c/ -> should be 1, is 1
103*23f24377SWarner Loshabbc ~ /ab{1,}c/ -> should be 1, is 1
104*23f24377SWarner Loshabbbc ~ /ab{1,}c/ -> should be 1, is 1
105*23f24377SWarner Loshabbbbc ~ /ab{1,}c/ -> should be 1, is 1
106*23f24377SWarner Loshac ~ /ab{0,1}c/ -> should be 1, is 1
107*23f24377SWarner Loshabc ~ /ab{0,1}c/ -> should be 1, is 1
108*23f24377SWarner Loshabbc ~ /ab{0,1}c/ -> should be 0, is 0
109*23f24377SWarner Loshac ~ /ab{0,3}c/ -> should be 1, is 1
110*23f24377SWarner Loshabc ~ /ab{0,3}c/ -> should be 1, is 1
111*23f24377SWarner Loshabbc ~ /ab{0,3}c/ -> should be 1, is 1
112*23f24377SWarner Loshabbbc ~ /ab{0,3}c/ -> should be 1, is 1
113*23f24377SWarner Loshabbbbc ~ /ab{0,3}c/ -> should be 0, is 0
114*23f24377SWarner Loshac ~ /ab{1,3}c/ -> should be 0, is 0
115*23f24377SWarner Loshabc ~ /ab{1,3}c/ -> should be 1, is 1
116*23f24377SWarner Loshabbc ~ /ab{1,3}c/ -> should be 1, is 1
117*23f24377SWarner Loshabbbc ~ /ab{1,3}c/ -> should be 1, is 1
118*23f24377SWarner Loshabbbbc ~ /ab{1,3}c/ -> should be 0, is 0
119*23f24377SWarner LoshEOF
120*23f24377SWarner Losh
121*23f24377SWarner Losh
122*23f24377SWarner Losh$awk -f prog foo.in > foo2
123*23f24377SWarner Loshdiff foo1 foo2 || echo 'BAD: T.int-expr (1)'
124*23f24377SWarner Loshrm -f prog
125