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