aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-03 12:03:03 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-03 12:03:03 -0400
commit6baa93f7fe80a402483f054139dcb88bf7076e62 (patch)
treeaec1f805ade75224ad5f80d4f287661e1ce8b042 /test
parent947dad705444c6c484f73ba3585a0f5388a50886 (diff)
Test character arithmetic
Diffstat (limited to 'test')
-rw-r--r--test/fuzz.bqn33
1 files changed, 20 insertions, 13 deletions
diff --git a/test/fuzz.bqn b/test/fuzz.bqn
index e2f20c27..274b70e4 100644
--- a/test/fuzz.bqn
+++ b/test/fuzz.bqn
@@ -114,13 +114,6 @@ Sigmoid ← (40≤|)◶⟨1(-÷+)˜⋆,×⟩
RandChar ⇐ Squeeze @ + ·(1≠surr⊸⍋)⊸× (0≍ch_end⌊2⋆2⋆⊣)⊸RandInterval
}
-# 𝕩 is bound
-RandMonArith ← RandArith⟜RandShape
-RandDyArith ← {
- Prefix ← (∨`⌾⌽ 𝕩 ≥ ×`)⊸/ (Rand 1+≠)⊸↑
- 𝕨⊸RandArith¨ (Rand 2) ⌽ ≍○<⟜Prefix RandShape 𝕩
-}
-
_testConsistent_ ← {Match←𝔾
v ← <˘⍉> (5⌊´≠¨)⊸((Rand⟜≠⊏⊢)¨) ListVariations¨ a←𝕨≍○<𝕩
(ClearRefs@) ⊢ (∧´ ⊏ Match¨ 1⊸↓) (𝕨 (𝔽⊑∘⊢)⊘(𝔽´⊢) Variation¨⟜a)¨ v
@@ -128,13 +121,27 @@ _testConsistent_ ← {Match←𝔾
FlatMatch ← ≡◶⟨∧´∘⥊=∨∧○(≠˜),1⟩
-TestMonArith ← {
- t ← 𝕨 RandMonArith 𝕩
- { ! 𝕏 _testConsistent_ FlatMatch t }¨ opts.monArith
+TestMonArith ← opts.monArith{
+ (0<≠f←𝕗) ⊑ 1‿{
+ _t ← { ! 𝕏 _testConsistent_ FlatMatch 𝕗 }
+ (𝕨 RandArith RandShape 𝕩)_t¨ f
+ }
+}
+
+RandDyShape ← {
+ Prefix ← (∨`⌾⌽ 𝕩 ≥ ×`)⊸/ (Rand 1+≠)⊸↑
+ (Rand 2) ⌽ ≍○<⟜Prefix RandShape 𝕩
}
-TestDyArith ← {
- t ← 𝕨 RandDyArith 𝕩
- { ! 𝕏 _testConsistent_ FlatMatch´ t }¨ opts.dyArith
+TestDyArith ← opts.dyArith{
+ (0<≠f←𝕗) ⊑ 1‿{
+ k ← 𝕨 ⋄ sh ← RandDyShape 𝕩
+ _t ← { ! 𝕏 _testConsistent_ FlatMatch´ 𝕗 }
+ (𝕨⊸RandArith¨ sh)_t¨ f
+ p‿m ← (∊/⊣)⟜f¨ ⟨+⟩‿⟨-⟩
+ rca ← ⟨RandChar,RandArith⟩
+ { ((⌽ ⍟(Rand∘2)rca){k𝕎𝕩}¨sh)_t 𝕩 }⎊1¨ p
+ { ((⊣`⍟(Rand∘2)rca){k𝕎𝕩}¨sh)_t 𝕩 }⎊1¨ m
+ }
}
t←opts.types ⋄ b←opts.num/opts.bounds