xref: /aosp_15_r20/external/one-true-awk/testdir/T.utfre (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughesecho T.utfre: tests of regular expression code for Unicode/utf-8
2*9a7741deSElliott Hughes# adapted from T.re
3*9a7741deSElliott Hughes
4*9a7741deSElliott Hughesawk '
5*9a7741deSElliott HughesBEGIN {
6*9a7741deSElliott Hughes	FS = "\t"
7*9a7741deSElliott Hughes	awk = "../a.out"
8*9a7741deSElliott Hughes}
9*9a7741deSElliott HughesNF == 0 {
10*9a7741deSElliott Hughes	next
11*9a7741deSElliott Hughes}
12*9a7741deSElliott Hughes$1 != "" {	# new test
13*9a7741deSElliott Hughes	re = $1
14*9a7741deSElliott Hughes}
15*9a7741deSElliott Hughes$2 != "" {	# either ~ or !~
16*9a7741deSElliott Hughes	op = $2
17*9a7741deSElliott Hughes	if (op == "~")
18*9a7741deSElliott Hughes		neg = "!"
19*9a7741deSElliott Hughes	else if (op == "!~")
20*9a7741deSElliott Hughes		neg = ""
21*9a7741deSElliott Hughes}
22*9a7741deSElliott Hughes$3 != "" {	# new test string
23*9a7741deSElliott Hughes	str = $3
24*9a7741deSElliott Hughes}
25*9a7741deSElliott Hughes$3 == "\"\"" {	# explicit empty line
26*9a7741deSElliott Hughes	$3 = ""
27*9a7741deSElliott Hughes}
28*9a7741deSElliott HughesNF > 2 {	# generate a test
29*9a7741deSElliott Hughes	input = $3
30*9a7741deSElliott Hughes	test = sprintf("./echo '"'"'%s'"'"' | %s '"'"'%s/%s/ {print \"%d fails %s %s %s\"}'"'"'",
31*9a7741deSElliott Hughes		input, awk, neg, re, NR, re, op, input)
32*9a7741deSElliott Hughes	# printf(" %3d   %s %s %s:\n", NR, re, op, input)
33*9a7741deSElliott Hughes	# print "test is |" test "|"
34*9a7741deSElliott Hughes	system(test)
35*9a7741deSElliott Hughes	# system("bprint -c ../a.out")
36*9a7741deSElliott Hughes	nt++
37*9a7741deSElliott Hughes}
38*9a7741deSElliott HughesEND { print "	" nt, "tests" }
39*9a7741deSElliott Hughes' <<\!!!!
40*9a7741deSElliott Hughes	~	��
41*9a7741deSElliott Hughes		����
42*9a7741deSElliott Hughes		������
43*9a7741deSElliott Hughes		""
44*9a7741deSElliott Hughes��	~	��
45*9a7741deSElliott Hughes		b��
46*9a7741deSElliott Hughes		b��b
47*9a7741deSElliott Hughes	!~	""
48*9a7741deSElliott Hughes49*9a7741deSElliott Hughes		xxxxx
50*9a7741deSElliott Hughes.	~	时
51*9a7741deSElliott Hughes		x时x
52*9a7741deSElliott Hughes		��
53*9a7741deSElliott Hughes	!~	""
54*9a7741deSElliott Hughes.の	~	xの
55*9a7741deSElliott Hughes		xxの
56*9a7741deSElliott Hughes		xのx
57*9a7741deSElliott Hughes	!~	の
58*9a7741deSElliott Hughes		のx
59*9a7741deSElliott Hughes		""
60*9a7741deSElliott Hughes$	~	x
61*9a7741deSElliott Hughes		��
62*9a7741deSElliott Hughes		""
63*9a7741deSElliott Hughes.$	~	모
64*9a7741deSElliott Hughes		xx모
65*9a7741deSElliott Hughes		x모x
66*9a7741deSElliott Hughes	!~	""
67*9a7741deSElliott Hughesд$	~	д
68*9a7741deSElliott Hughes69*9a7741deSElliott Hughes		bbbд
70*9a7741deSElliott Hughes	!~	дb
71*9a7741deSElliott Hughes		x
72*9a7741deSElliott Hughes		""
73*9a7741deSElliott Hughes^	~	и
74*9a7741deSElliott Hughes		""
75*9a7741deSElliott Hughes		^
76*9a7741deSElliott Hughes^λ$	~	λ
77*9a7741deSElliott Hughes	!~	xλ
78*9a7741deSElliott Hughes		λx
79*9a7741deSElliott Hughes		xλx
80*9a7741deSElliott Hughes		""
81*9a7741deSElliott Hughes^λ.$	~	λx
82*9a7741deSElliott Hughes		λλ
83*9a7741deSElliott Hughes	!~	xλ
84*9a7741deSElliott Hughes		λλλ
85*9a7741deSElliott Hughes		λxy
86*9a7741deSElliott Hughes		""
87*9a7741deSElliott Hughes^$	~	""
88*9a7741deSElliott Hughes	!~	に
89*9a7741deSElliott Hughes		^
90*9a7741deSElliott Hughes^.해	~	め해
91*9a7741deSElliott Hughes		め해해
92*9a7741deSElliott Hughes	!~	해
93*9a7741deSElliott Hughes		""
94*9a7741deSElliott Hughes^.*해	~	해
95*9a7741deSElliott Hughes		め해
96*9a7741deSElliott Hughes		めめめめめめ해
97*9a7741deSElliott Hughes	!~	""
98*9a7741deSElliott Hughes^.+해	~	め해
99*9a7741deSElliott Hughes		めめめめめめ해
100*9a7741deSElliott Hughes	!~	""
101*9a7741deSElliott Hughes102*9a7741deSElliott Hughes		해め
103*9a7741deSElliott Hughes해*	~	""
104*9a7741deSElliott Hughes105*9a7741deSElliott Hughes		해해해해
106*9a7741deSElliott Hughes		め해
107*9a7741deSElliott Hughes		めめめめ
108*9a7741deSElliott Hughes해해*	~	해
109*9a7741deSElliott Hughes		해해해
110*9a7741deSElliott Hughes		め해
111*9a7741deSElliott Hughes	!~	めめめめ
112*9a7741deSElliott Hughes		""
113*9a7741deSElliott Hughes\$	~	��$
114*9a7741deSElliott Hughes		$
115*9a7741deSElliott Hughes		$��
116*9a7741deSElliott Hughes		��$��
117*9a7741deSElliott Hughes	!~	""
118*9a7741deSElliott Hughes		��
119*9a7741deSElliott Hughes\.	~	.
120*9a7741deSElliott Hughes	!~	��
121*9a7741deSElliott Hughes		""
122*9a7741deSElliott Hughesxθ+y	~	xθy
123*9a7741deSElliott Hughes		xθθy
124*9a7741deSElliott Hughes		xθθθθθθy
125*9a7741deSElliott Hughes	!~	θy
126*9a7741deSElliott Hughes		xy
127*9a7741deSElliott Hughes128*9a7741deSElliott Hughesxθ?y	~	xy
129*9a7741deSElliott Hughes		xθy
130*9a7741deSElliott Hughes	!~	xθθy
131*9a7741deSElliott Hughesθ?b?の?	~	""
132*9a7741deSElliott Hughes		x
133*9a7741deSElliott Hughes^a?b?め	~	め
134*9a7741deSElliott Hughes		aめ
135*9a7741deSElliott Hughes		bめ
136*9a7741deSElliott Hughes		abめ
137*9a7741deSElliott Hughes		めa
138*9a7741deSElliott Hughes	!~	""
139*9a7741deSElliott Hughes		ab
140*9a7741deSElliott Hughes		aba
141*9a7741deSElliott Hughes[Α-Ω]	~	Α
142*9a7741deSElliott Hughes		aΔb
143*9a7741deSElliott Hughes		xyΩ
144*9a7741deSElliott Hughes	!~	abc
145*9a7741deSElliott Hughes		β
146*9a7741deSElliott Hughes		""
147*9a7741deSElliott Hughes[^Α-Ω]	~	δ
148*9a7741deSElliott Hughes		aΔb
149*9a7741deSElliott Hughes		xyΩ
150*9a7741deSElliott Hughes	!~	Α
151*9a7741deSElliott Hughes		Δ
152*9a7741deSElliott Hughes		""
153*9a7741deSElliott Hughes[Α-ΔΦ-Ω]	~	Α
154*9a7741deSElliott Hughes		Β
155*9a7741deSElliott Hughes		Δ
156*9a7741deSElliott Hughes		Φ
157*9a7741deSElliott Hughes		Ω
158*9a7741deSElliott Hughes	!~	Π
159*9a7741deSElliott Hughes		Σ
160*9a7741deSElliott HughesΠ[[:lower:]]+	~	Πa
161*9a7741deSElliott Hughes		Πab
162*9a7741deSElliott Hughes	!~	Π
163*9a7741deSElliott Hughes		ΠX
164*9a7741deSElliott Hughes		Π:
165*9a7741deSElliott Hughes		Π[
166*9a7741deSElliott Hughes		Π]
167*9a7741deSElliott Hughesの[0-9]+に	~	の0に
168*9a7741deSElliott Hughes		の23に
169*9a7741deSElliott Hughes		の12345に
170*9a7741deSElliott Hughes	!~	0に
171*9a7741deSElliott Hughes		のに
172*9a7741deSElliott Hughesの[0-9]?に	~	のに
173*9a7741deSElliott Hughes		の1に
174*9a7741deSElliott Hughes	!~	の23に
175*9a7741deSElliott Hughesの[[]に	~	の[に
176*9a7741deSElliott Hughes	!~	のに
177*9a7741deSElliott Hughes		の[[]に
178*9a7741deSElliott Hughes		の]に
179*9a7741deSElliott Hughesの[[-]に	~	の[に
180*9a7741deSElliott Hughes		の-に
181*9a7741deSElliott Hughes	!~	のに
182*9a7741deSElliott Hughes		の[[]に
183*9a7741deSElliott Hughes		の]に
184*9a7741deSElliott Hughesの[[-a]に	~	の[に
185*9a7741deSElliott Hughes		のaに
186*9a7741deSElliott Hughes		の]に
187*9a7741deSElliott Hughes	!~	のに
188*9a7741deSElliott Hughes		の[[]に
189*9a7741deSElliott Hughes		の-に
190*9a7741deSElliott Hughesの[]-a]に	~	の]に
191*9a7741deSElliott Hughes		のaに
192*9a7741deSElliott Hughes	!~	のに
193*9a7741deSElliott Hughes		の[に
194*9a7741deSElliott Hughes		の-に
195*9a7741deSElliott Hughesの[]]に	~	の]に
196*9a7741deSElliott Hughes	!~	のに
197*9a7741deSElliott Hughes		の[]]に
198*9a7741deSElliott Hughes		の[に
199*9a7741deSElliott Hughesの[^[]に	~	のaに
200*9a7741deSElliott Hughes	!~	の[に
201*9a7741deSElliott Hughesの[-]に	~	の-に
202*9a7741deSElliott Hughes	!~	のに
203*9a7741deSElliott Hughes		の+に
204*9a7741deSElliott Hughesの[^-]に	~	の+に
205*9a7741deSElliott Hughes	!~	の-に
206*9a7741deSElliott Hughes		のに
207*9a7741deSElliott Hughesの[][]に	~	の[に
208*9a7741deSElliott Hughes		の]に
209*9a7741deSElliott Hughes	!~	のに
210*9a7741deSElliott Hughes		の][に
211*9a7741deSElliott Hughes		の[]に
212*9a7741deSElliott Hughesの[z-a]に	~	のに
213*9a7741deSElliott Hughes	!~	の
214*9a7741deSElliott Hughes215*9a7741deSElliott Hughes		のaに
216*9a7741deSElliott Hughes		のzに
217*9a7741deSElliott Hughes		の-に
218*9a7741deSElliott Hughesに|だ	~	だ
219*9a7741deSElliott Hughes220*9a7741deSElliott Hughes		だに
221*9a7741deSElliott Hughes	!~	a
222*9a7741deSElliott Hughes		""
223*9a7741deSElliott Hughes^στο|τους$	~	στο
224*9a7741deSElliott Hughes		στοd
225*9a7741deSElliott Hughes		aτους
226*9a7741deSElliott Hughes		τους
227*9a7741deSElliott Hughes	!~	xστο
228*9a7741deSElliott Hughes		τουςa
229*9a7741deSElliott Hughes^(στο|τους)$	~	στο
230*9a7741deSElliott Hughes		τους
231*9a7741deSElliott Hughes	!~	στοτους
232*9a7741deSElliott Hughes		στοx
233*9a7741deSElliott Hughes		cτους
234*9a7741deSElliott Hughes!!!!
235