aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-01-13 21:40:51 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-01-13 21:40:51 -0500
commitb1937178ffcb3c24eebe01f0c77bacd5547bbce1 (patch)
tree5c4de3549eb15850559109997b090da94aec8788 /test
parent80060dfab6cc93719b27b6f8ff3f3c5138f33781 (diff)
Add some test cases for Under
Diffstat (limited to 'test')
-rw-r--r--test/cases/under.bqn44
-rw-r--r--test/cases/undo.bqn2
2 files changed, 45 insertions, 1 deletions
diff --git a/test/cases/under.bqn b/test/cases/under.bqn
new file mode 100644
index 00000000..acef50b7
--- /dev/null
+++ b/test/cases/under.bqn
@@ -0,0 +1,44 @@
+# Invertible
+(⊑≡⊑⌾⊢) ⟨↕3,2,<"abc"⟩
+3 (+≡+⌾⊣) 4
+(¯2⊸↓ ≡ 2⊸↓⌾⌽) ↕6
+(1⊸↓⌾⍉ ≡ 1⊸↓˘) ↕3‿3
+7(⥊⌾(<˘)≡·<˘⁼⥊⟜(<˘))3‿3⥊↕9
+"abcd" (⊣≡»⌾≍) ↕4
+! % ⍉⌾≍ "abc"
+(⌽∘|⊸/4‿¯3) ≡ ↕∘≠⊸-⌾(3⊸⌽)↕7
+
+# Structural
+# Monad
+"bbcd" ≡ 1⊸+⌾⊑ "abcd"
+(<∘- ≡ -⌾⊑) 4
+(⌽⌾⊏ ≡ ⌽⊸≍˝) "abc"≍"def"
+! % -⌾⊏ 4
+1 ≡ "cd"‿"ab"⊸⊐⌾< "ab"
+(0‿1+⌜0‿4‿2) ≡ ⍋∘⍋⌾⥊ "apl"≍"bqn"
+2 (⌽⌾⥊ ≡ 12|+) ⥊⟜(↕×´)6‿2
+#↕⊸≠⊸+{𝔽≡𝔽¨⌾↑} "abcde"
+#2⊸+{𝔽≡𝔽¨⌾↓} "abcde"
+# Dyad
+! % ↕⊸≠⊸+⌾(10⊸⥊)↕6
+(⌽⍒⌊2÷˜↕7) ≡ ⌽˘⌾(⌊‿2⥊⊢)↕7
+¯1‿0‿1‿3 ≡ -⟜(+´÷≠)⌾(3⊸↑)↕4
+"adcb" ≡ ⌽⌾(1⊸↓)"abcd"
+5‿6‿3‿0 ≡ (5‿3‿1⌾(0‿0⊸⍉)4‿3⥊0) +´∘×⎉1‿∞ 1+↕3
+"AbcD" ≡ ('A'-'a')⊸+⌾(1‿0‿0‿1⊸/)"abcd"
+"AbcD" ≡ "ABCD"⊣⌾(1‿0‿0‿1⊸/)"abcd"
+! % ↕⊸≠⊸+⌾(2⊸/)↕5
+#(1⊸⌽ ≡ 2⊸⌽⌾(2⊸/)) ↕5
+"bdca" ≡ 1⊸⌽⌾(1‿3‿0⊸⊏)"abcd"
+#! % 1⊸⌽⌾(1‿3‿3‿0⊸⊏)"abcd"
+((¯1⋆2∧⌜○(⌽0=↕)3)⊸× ≡ -⌾(1‿2⊑⊢))↕2‿3
+# Compound
+(1+↕3) ≡ 1⊸↓⌾(@⊢·⊑<)↕4
+"210abc" ≡ ⌽⌾((2÷˜≠)⊸↑)"012abc"
+"bac"‿'d' ≡ ⌽⌾(2↑⊑)"abc"‿'d'
+
+# Computational
+3 % 1⊸+⌾-4
+2 % ⊢⌾2 3
+-2 % ⊢⌾(2∘-) 3
+#1 % ⊢⌾∘‿+ 1
diff --git a/test/cases/undo.bqn b/test/cases/undo.bqn
index 5555b9fb..53595206 100644
--- a/test/cases/undo.bqn
+++ b/test/cases/undo.bqn
@@ -5,7 +5,7 @@
# Primitives
∧´ {(𝕎≡𝕎⁼)𝕩}⟜¯0.3‿0‿8¨ +‿-‿÷‿¬‿⊢‿⊣‿⌽
-#! % -⁼ 'a'
+! % -⁼ 'a'
(√√⁼)⊸≡ 0‿0.4‿π‿1e9‿∞
(⋆⁼⋆)⊸≡ ↕4
1e¯14>|1-⋆+´⋆⁼1(⊢÷«)1+↕11