head 1.1; branch 1.1.1; access; symbols netbsd-11-0-RC5:1.1.1.1 netbsd-11-0-RC4:1.1.1.1 NAWK20260426:1.1.1.1 netbsd-11-0-RC3:1.1.1.1 netbsd-11-0-RC2:1.1.1.1 netbsd-11-0-RC1:1.1.1.1 perseant-exfatfs:1.1.1.1.0.4 perseant-exfatfs-base-20250801:1.1.1.1 netbsd-11:1.1.1.1.0.2 netbsd-11-base:1.1.1.1 NAWK20240817:1.1.1.1 NAWK:1.1.1; locks; strict; comment @# @; 1.1 date 2024.08.17.22.19.23; author christos; state Exp; branches 1.1.1.1; next ; commitid F6k4yChqfBas4emF; 1.1.1.1 date 2024.08.17.22.19.23; author christos; state Exp; branches 1.1.1.1.4.1; next ; commitid F6k4yChqfBas4emF; 1.1.1.1.4.1 date 2024.08.17.22.19.23; author perseant; state dead; branches; next 1.1.1.1.4.2; commitid 23j6GFaDws3O875G; 1.1.1.1.4.2 date 2025.08.02.05.49.46; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.1 log @Initial revision @ text @echo T.utfre: tests of regular expression code for Unicode/utf-8 # adapted from T.re awk ' BEGIN { FS = "\t" awk = "../a.out" } NF == 0 { next } $1 != "" { # new test re = $1 } $2 != "" { # either ~ or !~ op = $2 if (op == "~") neg = "!" else if (op == "!~") neg = "" } $3 != "" { # new test string str = $3 } $3 == "\"\"" { # explicit empty line $3 = "" } NF > 2 { # generate a test input = $3 test = sprintf("./echo '"'"'%s'"'"' | %s '"'"'%s/%s/ {print \"%d fails %s %s %s\"}'"'"'", input, awk, neg, re, NR, re, op, input) # printf(" %3d %s %s %s:\n", NR, re, op, input) # print "test is |" test "|" system(test) # system("bprint -c ../a.out") nt++ } END { print " " nt, "tests" } ' <<\!!!! ~ 🖕 🖕🖕 🖕🖕🖕 "" 🖕 ~ 🖕 b🖕 b🖕b !~ "" 时 xxxxx . ~ 时 x时x 🙂 !~ "" .の ~ xの xxの xのx !~ の のx "" $ ~ x 🙂 "" .$ ~ 모 xx모 x모x !~ "" д$ ~ д bд bbbд !~ дb x "" ^ ~ и "" ^ ^λ$ ~ λ !~ xλ λx xλx "" ^λ.$ ~ λx λλ !~ xλ λλλ λxy "" ^$ ~ "" !~ に ^ ^.해 ~ め해 め해해 !~ 해 "" ^.*해 ~ 해 め해 めめめめめめ해 !~ "" ^.+해 ~ め해 めめめめめめ해 !~ "" 해 해め 해* ~ "" 해 해해해해 め해 めめめめ 해해* ~ 해 해해해 め해 !~ めめめめ "" \$ ~ 🖕$ $ $🖕 🖕$🖕 !~ "" 🖕 \. ~ . !~ 🖕 "" xθ+y ~ xθy xθθy xθθθθθθy !~ θy xy xθ xθ?y ~ xy xθy !~ xθθy θ?b?の? ~ "" x ^a?b?め ~ め aめ bめ abめ めa !~ "" ab aba [Α-Ω] ~ Α aΔb xyΩ !~ abc β "" [^Α-Ω] ~ δ aΔb xyΩ !~ Α Δ "" [Α-ΔΦ-Ω] ~ Α Β Δ Φ Ω !~ Π Σ Π[[:lower:]]+ ~ Πa Πab !~ Π ΠX Π: Π[ Π] の[0-9]+に ~ の0に の23に の12345に !~ 0に のに の[0-9]?に ~ のに の1に !~ の23に の[[]に ~ の[に !~ のに の[[]に の]に の[[-]に ~ の[に の-に !~ のに の[[]に の]に の[[-a]に ~ の[に のaに の]に !~ のに の[[]に の-に の[]-a]に ~ の]に のaに !~ のに の[に の-に の[]]に ~ の]に !~ のに の[]]に の[に の[^[]に ~ のaに !~ の[に の[-]に ~ の-に !~ のに の+に の[^-]に ~ の+に !~ の-に のに の[][]に ~ の[に の]に !~ のに の][に の[]に の[z-a]に ~ のに !~ の に のaに のzに の-に に|だ ~ だ に だに !~ a "" ^στο|τους$ ~ στο στοd aτους τους !~ xστο τουςa ^(στο|τους)$ ~ στο τους !~ στοτους στοx cτους !!!! @ 1.1.1.1 log @Import the current version of nawk from github. Last was imported on 2020-02-18. The major change is utf8 handling. @ text @@ 1.1.1.1.4.1 log @file T.utfre was added on branch perseant-exfatfs on 2025-08-02 05:49:46 +0000 @ text @d1 234 @ 1.1.1.1.4.2 log @Sync with HEAD @ text @a0 234 echo T.utfre: tests of regular expression code for Unicode/utf-8 # adapted from T.re awk ' BEGIN { FS = "\t" awk = "../a.out" } NF == 0 { next } $1 != "" { # new test re = $1 } $2 != "" { # either ~ or !~ op = $2 if (op == "~") neg = "!" else if (op == "!~") neg = "" } $3 != "" { # new test string str = $3 } $3 == "\"\"" { # explicit empty line $3 = "" } NF > 2 { # generate a test input = $3 test = sprintf("./echo '"'"'%s'"'"' | %s '"'"'%s/%s/ {print \"%d fails %s %s %s\"}'"'"'", input, awk, neg, re, NR, re, op, input) # printf(" %3d %s %s %s:\n", NR, re, op, input) # print "test is |" test "|" system(test) # system("bprint -c ../a.out") nt++ } END { print " " nt, "tests" } ' <<\!!!! ~ 🖕 🖕🖕 🖕🖕🖕 "" 🖕 ~ 🖕 b🖕 b🖕b !~ "" 时 xxxxx . ~ 时 x时x 🙂 !~ "" .の ~ xの xxの xのx !~ の のx "" $ ~ x 🙂 "" .$ ~ 모 xx모 x모x !~ "" д$ ~ д bд bbbд !~ дb x "" ^ ~ и "" ^ ^λ$ ~ λ !~ xλ λx xλx "" ^λ.$ ~ λx λλ !~ xλ λλλ λxy "" ^$ ~ "" !~ に ^ ^.해 ~ め해 め해해 !~ 해 "" ^.*해 ~ 해 め해 めめめめめめ해 !~ "" ^.+해 ~ め해 めめめめめめ해 !~ "" 해 해め 해* ~ "" 해 해해해해 め해 めめめめ 해해* ~ 해 해해해 め해 !~ めめめめ "" \$ ~ 🖕$ $ $🖕 🖕$🖕 !~ "" 🖕 \. ~ . !~ 🖕 "" xθ+y ~ xθy xθθy xθθθθθθy !~ θy xy xθ xθ?y ~ xy xθy !~ xθθy θ?b?の? ~ "" x ^a?b?め ~ め aめ bめ abめ めa !~ "" ab aba [Α-Ω] ~ Α aΔb xyΩ !~ abc β "" [^Α-Ω] ~ δ aΔb xyΩ !~ Α Δ "" [Α-ΔΦ-Ω] ~ Α Β Δ Φ Ω !~ Π Σ Π[[:lower:]]+ ~ Πa Πab !~ Π ΠX Π: Π[ Π] の[0-9]+に ~ の0に の23に の12345に !~ 0に のに の[0-9]?に ~ のに の1に !~ の23に の[[]に ~ の[に !~ のに の[[]に の]に の[[-]に ~ の[に の-に !~ のに の[[]に の]に の[[-a]に ~ の[に のaに の]に !~ のに の[[]に の-に の[]-a]に ~ の]に のaに !~ のに の[に の-に の[]]に ~ の]に !~ のに の[]]に の[に の[^[]に ~ のaに !~ の[に の[-]に ~ の-に !~ のに の+に の[^-]に ~ の+に !~ の-に のに の[][]に ~ の[に の]に !~ のに の][に の[]に の[z-a]に ~ のに !~ の に のaに のzに の-に に|だ ~ だ に だに !~ a "" ^στο|τους$ ~ στο στοd aτους τους !~ xστο τουςa ^(στο|τους)$ ~ στο τους !~ στοτους στοx cτους !!!! @