aboutsummaryrefslogtreecommitdiff
path: root/test/fuzz.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-05-31 22:25:33 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-05-31 22:25:33 -0400
commitabce2c6b19466aabcec0768b8bdf707ec1b879af (patch)
tree3b970d09c7fc70b467eb1a8ac4bcf4d3576825ad /test/fuzz.bqn
parentdcd886d3a4b03b869c0d27dcaa09302d9cf40de8 (diff)
Consistency testing with •internal.Variation
Diffstat (limited to 'test/fuzz.bqn')
-rw-r--r--test/fuzz.bqn13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/fuzz.bqn b/test/fuzz.bqn
index 74944849..bf8e72ce 100644
--- a/test/fuzz.bqn
+++ b/test/fuzz.bqn
@@ -1,4 +1,5 @@
# Tester that checks primitives on random arguments
+Squeeze‿ListVariations‿Variation‿ClearRefs ← •internal
Range ← (•MakeRand 2).Range
Rand ← {𝕨 Range 1⌈𝕩}
@@ -64,7 +65,7 @@ Sigmoid ← (40≤|)◶⟨1(-÷+)˜⋆,×⟩
⊢ ⥊ RL⟜(1⌈RN) # Repeat
Combine Rand‿⊢_randChoose⊸RL¨⟜RandSplit # Partition
⟩{ 8⊸≤◶⟨0,Rand∘(≠𝕗)⟩◶𝕗 }
- RandArith ⇐ •internal.Squeeze ⊢ ⥊ RandList⟜(×´)
+ RandArith ⇐ Squeeze ⊢ ⥊ RandList⟜(×´)
}
# 𝕩 is bound
@@ -74,5 +75,13 @@ RandDyArith ← {
𝕨⊸RandArith¨ (Rand 2) ⌽ ≍○<⟜Prefix RandShape 𝕩
}
+_testConsistent_ ← {Match←𝔾
+ v ← <˘⍉> (5⌊´≠¨)⊸((Rand⟜≠⊏⊢)¨) ListVariations¨ a←𝕨≍○<𝕩
+ (ClearRefs@) ⊢ (∧´ ⊏ Match¨ 1⊸↓) (𝕨 (𝔽⊑∘⊢)⊘(𝔽´⊢) Variation¨⟜a)¨ v
+}
+
+FlatMatch ← ≡◶⟨∧´∘⥊=∨∧○(≠˜),1⟩
types ← 0‿3‿4‿5‿6
-types { ! (𝕨+𝕩)≡◶⟨∧´∘⥊=∨∧○(≠˜),1⟩𝕨--𝕩 }´∘RandDyArith⌜ 100⥊1e3
+dyArith ← +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿∧‿∨‿¬‿|‿≤‿<‿>‿≥‿=‿≠
+Test ← { 0○•Show˜⍟{ ¬ 𝕎 _testConsistent_ FlatMatch´ 𝕩 }⟜𝕩¨ dyArith }
+types Test∘RandDyArith⌜ 10⥊100