Skip to content

Commit cad15d7

Browse files
authored
refactor(test): under regex (#824)
1 parent 6a813e2 commit cad15d7

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

tests/under.ua

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,27 @@ F ← ⌅(+|⌅(-|⟜-|×10+))
469469
⍤⤙≍ 20 ⍜⌝F∘ 1 2
470470
⍤⤙≍ 20 ⍜(⌝F1)∘ 2
471471

472+
# Regex
473+
⍤⤙≍ Lorem ⍜(regex"\\w+")∘ Lorem
474+
H ← "Hello, world!!"
475+
⍤⤙≍ "world, Hello!!" ⍜regex⇌ ⊙H$ \w+
476+
⍤⤙≍ "Holle, wdlro!!" ⍜regex⍚(⊂⋅⊙⇌°□₃) ⊙H$ (\w)(\w+)
477+
⍤⤙≍ 0 ⍤⤙≍ H ⍜regex⟜⧻ ⊙H$ \d+
478+
⍤⤙≍ "@, w!!" ⬚@@⍜regex≡⊣ ⊙H$ \b([a-z])?\w*\s?
479+
⍤⤙≍ "HHello, wworld!!" ⍜regex≡(◇▽2⊣) ⊙H$ \b(\w)
480+
⍤⤙≍ ".H.e.l.l.o.,. . . .w.o.r.l.d.!.!." ⍜regex⋅@. "" H
481+
# different replacement forms:
482+
⊙H $ (\w)(\w*)
483+
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex⍜≡⊢⍚⇌ # 2d, boxed strings
484+
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex(⍚⇌≡⊢) # 1d boxed strings
485+
⍤⤙≍ "bip, bip!!" ◡⍜regex⋅(□"bip") # boxed string
486+
⍤⤙≍ "*, *!!" ◡⍜regex⋅(□@*) # boxed char
487+
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⊟◇⊸⇌⊢) # 2d strings
488+
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(◇⇌⊢) # 1d strings
489+
⍤⤙≍ "bip, bip!!" ◡⍜regex⋅"bip" # string
490+
⍤⤙≍ "*, *!!" ◡⍜regex⋅@* # char
491+
⋅◌
492+
472493
# Experimental!
473494

474495
# Un under
@@ -485,25 +506,3 @@ F ← ⌅(+|⌅(-|⟜-|×10+))
485506
⍤⤙≍ [¯1 ∞ ¯2] [⍜𝄐⊟¯ 1 ∞ 2]
486507
⍤⤙≍ [4 ∞ 5] [⍜(⊟⊙◌)+ 1 ∞ 2 3]
487508
⍤⤙≍ [¯1 ∞ ¯2] [⍜(⊟⊙◌)¯ 1 ∞ 2]
488-
489-
# Regex
490-
⍤⤙≍ Lorem ⍜(regex"\\w+")∘ Lorem
491-
H ← "Hello, world!!"
492-
⍤⤙≍ "world, Hello!!" ⍜regex⇌ ⊙H$ \w+
493-
⍤⤙≍ "Holle, wdlro!!" ⍜regex≡(□⊂⋅⊙⇌°□₃) ⊙H$ (\w)(\w+)
494-
⍤⤙≍ 0 ⍤⤙≍ H ⍜regex⟜⧻ ⊙H$ \d+
495-
⍤⤙≍ "@, w!!" ⬚@@⍜regex≡⊣ ⊙H$ \b([a-z])?\w*\s?
496-
⍤⤙≍ "HHello, wworld!!" ⍜regex≡(▽2°□⊣) ⊙H$ \b(\w)
497-
⍤⤙≍ ".H.e.l.l.o.,. . . .w.o.r.l.d.!.!." ⍜regex⋅@. "" H
498-
# different replacement forms:
499-
⊙H $ (\w)(\w*)
500-
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡⍜⊢⍚⇌ # 2d, boxed strings
501-
# TODO: remove ∘ when the misoptimization is fixed
502-
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(∘⍚⇌⊢) # 1d boxed strings
503-
⍤⤙≍ "bip, bip!!" ◡⍜regex⋅(□"bip") # boxed string
504-
⍤⤙≍ "*, *!!" ◡⍜regex⋅(□@*) # boxed char
505-
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⇌°□⊢) # 2d strings
506-
⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⊟⊸⇌°□⊢) # 1d strings
507-
⍤⤙≍ "bip, bip!!" ◡⍜regex⋅"bip" # string
508-
⍤⤙≍ "*, *!!" ◡⍜regex⋅@* # char
509-
⋅◌

0 commit comments

Comments
 (0)