diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-06-01 21:54:53 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-06-01 21:54:53 -0400 |
| commit | 184348fd6bc7f249d1905f6520fbb407a5b4a366 (patch) | |
| tree | 0c280095cfbc5698def15415204052393a2e764d | |
| parent | 60867dcb5d3aa8f04dbc7b8cb3d0f97a1c15f6eb (diff) | |
Allow -p to specify a primitive set to test
| -rw-r--r-- | test/fuzz.bqn | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/fuzz.bqn b/test/fuzz.bqn index 38e11476..5f655f78 100644 --- a/test/fuzz.bqn +++ b/test/fuzz.bqn @@ -7,18 +7,30 @@ Fuzz testing. Options: -b: Maximum bound (1e3) -n: Number of iterations (100) -t: Element type (0 3 4 5 6) + -p: Primitives: both | mon%dy | mon%dy%both Any number of types or bounds can be given; all combinations are tested." - o ← "-h"‿"--help"‿"-b"‿"-n"‿"-t" + o ← "-h"‿"--help"‿"-b"‿"-n"‿"-t"‿"-p" oo ← (≠o) = oi ← o ⊐ a←•args •Exit∘•Out∘help⍟(∨´2⊸>) oi - bounds‿num‿types ⇐ •BQN¨¨ 3↑2↓ a ⊔˜ (¬-˜⊢× oi⊏˜ ↕∘≠⌈`∘׬)oo + opts ← 2↓o≠⊸↑ a ⊔˜ (¬-˜⊢× oi⊏˜ ↕∘≠⌈`∘׬)oo + bounds‿num‿types‿prims ⇐ •BQN¨¨⌾(¯1⊸↓) opts "Only one iteration number can be given" ! 1≥≠num num ↩ ≠◶⟨100,+´⟩ num types ↩ 0‿3‿4‿5‿6⍟(0=≠) types bounds ↩ ⟨1e3⟩⍟(0=≠) bounds + + prims ↩ ((⊢-˜¬×+`+2×·¬∨´)'%'⊸=)¨⊸(⊔○∾) prims + "At most three %-separated primitive groups allowed" ! 3≥≠prims + arith ← ∾`"+-×÷⋆√⌊⌈¬|"‿"∧∨≤<>≥=≠" + Pr ← { + 𝕩 ↩ 2 (↑((¬∘∊/⊣)∾⊢)¨⊏) 3 ↑ 𝕩 + "Only arithmetic primitives supported" ! ∧´∾𝕩∊¨arith + 𝕩 + } + monArith‿dyArith ⇐ •BQN∘⥊¨¨ prims ↩ (0<≠)◶arith‿Pr prims } Squeeze‿ListVariations‿Variation‿ClearRefs ← •internal @@ -103,16 +115,14 @@ _testConsistent_ ← {Match←𝔾 } FlatMatch ← ≡◶⟨∧´∘⥊=∨∧○(≠˜),1⟩ -monArith← +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿ ¬‿| -dyArith ← +‿-‿×‿÷‿⋆‿√‿⌊‿⌈‿∧‿∨‿¬‿|‿≤‿<‿>‿≥‿=‿≠ TestMonArith ← { t ← 𝕨 RandMonArith 𝕩 - { ! 𝕏 _testConsistent_ FlatMatch t }¨ monArith + { ! 𝕏 _testConsistent_ FlatMatch t }¨ opts.monArith } TestDyArith ← { t ← 𝕨 RandDyArith 𝕩 - { ! 𝕏 _testConsistent_ FlatMatch´ t }¨ dyArith + { ! 𝕏 _testConsistent_ FlatMatch´ t }¨ opts.dyArith } t←opts.types ⋄ b←opts.num/opts.bounds |
