aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-01 22:46:17 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-01 22:46:17 -0400
commitf695b4db0d89d340cff046b17c04968824faf27e (patch)
tree04360321e03394042d9e1ed1ca915c8938e08de8
parent41e459603dc7c1552194da7450ed2daeed6c0053 (diff)
Fuzz testing for /⊏
-rw-r--r--test/fuzz.bqn17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/fuzz.bqn b/test/fuzz.bqn
index 0043e62d..ae187fe6 100644
--- a/test/fuzz.bqn
+++ b/test/fuzz.bqn
@@ -184,12 +184,29 @@ _testDySearch ← { # ⊐⊒∊⍋⍒
as { ! 𝕨 𝕏 _testConsistent_ FlatMatch b }¨ {𝕏˜}⍟(∊˙⊸=)¨ 𝕗
}
+RandRep ← -⟜»∘∧ 1⊸+⊸gen.Index⟜⥊
+_testIndices ← { # /
+ (RandRep○RandBound˜ 𝕩)⊸{ ! 𝕏 _testConsistent_ FlatMatch 𝕨 }¨ 𝕗
+}
+_testSelect ← { # /⊏
+ l‿sh ← (⍋≠¨)⊸⊏ RandShape¨ 𝕩‿𝕩
+ n ← RandBound 𝕩
+ d ← 𝕨 gen.Struct sh
+ RandInd ← 0⊸≠◶⟨⟨⟩,gen.Index⟜(⥊‿RandShape _randChoose)˜⟩
+ g ← (/‿⊏ ⊐ 𝕗) ⊏ RandRep‿RandInd
+ g { ! (n𝕎 ⊑sh) 𝕏 _testConsistent_ FlatMatch d }¨ 𝕗
+ g { ! (l𝕎¨l≠⊸↑sh) 𝕏 _testConsistent_ FlatMatch d }¨ 𝕗
+}
+
cases ← ⟨
⟨∾`"+-×÷⋆√⌊⌈¬|"‿"∧∨≤<>≥=≠", testMonArith‿testDyArith⟩
⟨"⥊≍⌽⍉⊏"‿"⥊↑↓↕⌽⍉", testMonStruct‿testDyStruct⟩ # Monadic «» hard to test
⟨"≠=≢"‿"", testDim‿@⟩
⟨""‿"≍∾«»", @‿testCombine⟩
⟨"⊐⊒∊⍷∧∨⍋⍒"‿"⊐⊒∊⍋⍒", testMonSearch‿testDySearch⟩
+ ⟨"/"‿"/⊏", testIndices‿testSelect⟩ # ⊔ has nested result
+# ↕<∾↑↓≡>⊑ % ⊑⍷
+# ˘⎉¨⚇⌜⁼⍟´˝`
MakeTests ← {
prim‿test ← <∘>˘ ⍉> 𝕨