From e01dcaa011a17d2c50fda513577bcc1ae6bf8276 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 3 Jul 2021 21:46:34 -0400 Subject: =?UTF-8?q?Use=20=E2=89=A1=20instead=20of=20FlatMatch=20for=20non-?= =?UTF-8?q?arithmetic=20testing=20(result=20can't=20be=20NaN)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/fuzz.bqn | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/fuzz.bqn b/test/fuzz.bqn index ae187fe6..7299416e 100644 --- a/test/fuzz.bqn +++ b/test/fuzz.bqn @@ -149,7 +149,7 @@ _testDyArith ← {f←𝕗 _testMonStruct ← { # ⥊≍⌽⍉⊏ k ← 3|1+ ⌽‿⊏ ⊐ 𝕗 sh ← k ⊏ {𝕏𝕨}` (1+⌈´k) ↑ ⟨RandShape 𝕩, 1⊸∾⍟(0=≠), 1⊸⌈⌾⊑⟩ - ((⊐sh) ⊏ 𝕨⊸gen.Struct¨ ⍷sh) { ! 𝕏 _testConsistent_ FlatMatch 𝕨 }¨ 𝕗 + ((⊐sh) ⊏ 𝕨⊸gen.Struct¨ ⍷sh) { ! 𝕏 _testConsistent_ ≡ 𝕨 }¨ 𝕗 } _testDyStruct ← { # ⥊↑↓↕⌽⍉ (no overtake) @@ -159,7 +159,7 @@ _testDyStruct ← { # ⥊↑↓↕⌽⍉ (no overtake) RT ← -RR¨⊢ p‿r ← <˘⍉> ⟨⟨⥊,(0∾1⊸↓)⍟(sh>○(0=×´)⊢)∘l⟩, ⟨↓,l‿RT _randChoose⟩ ⟨⌽,RT+˜⟩, ⟨↑,RT⟩, ⟨↕,0 RR¨ 1⊸+⟩, ⟨⍉,(⍋⊏⊐)Rand˜∘≠⟩⟩ - (r⊏˜p⊐𝕗) { ! (𝕎sh) 𝕏 _testConsistent_ FlatMatch d }¨ 𝕗 + (r⊏˜p⊐𝕗) { ! (𝕎sh) 𝕏 _testConsistent_ ≡ d }¨ 𝕗 } _testDim ← { # ≠=≢ @@ -170,23 +170,23 @@ _testCombine ← { # ≍∾«» a ← 𝕨 gen.Struct sh ← RandShape1 𝕩 bs ← (RandBound 1⊸+)⌾⊑⍟({≍}≠𝕗) sh swap ← (Rand 2)⊑{𝔽}‿˜ - ((⊐bs) ⊏ 𝕨⊸gen.Struct¨ ⍷bs) { ! a 𝕏 _testConsistent_ FlatMatch _swap 𝕨 }¨ 𝕗 + ((⊐bs) ⊏ 𝕨⊸gen.Struct¨ ⍷bs) { ! a 𝕏 _testConsistent_ ≡ _swap 𝕨 }¨ 𝕗 } _testMonSearch ← { # ⊐⊒∊⍷∧∨⍋⍒ - (𝕨 gen.Arith RandShape1 𝕩)⊸{ ! 𝕏 _testConsistent_ FlatMatch 𝕨 }¨ 𝕗 + (𝕨 gen.Arith RandShape1 𝕩)⊸{ ! 𝕏 _testConsistent_ ≡ 𝕨 }¨ 𝕗 } _testDySearch ← { # ⊐⊒∊⍋⍒ sh ← RandShape1 𝕩 k ← ⍋‿⍒⊐𝕗 a‿b ← 𝕨⊸gen.Arith¨ ⟨sh, (0⊸<◶⟨-⟜⌊RandShape∘𝕩,RandShape⟩·⌊𝕩÷1⌈×´)⊸∾ 1↓sh⟩ as ← (⊐k) ⊏ {𝕏a}¨(⍷k)⊏∧‿∨‿⊢ - as { ! 𝕨 𝕏 _testConsistent_ FlatMatch b }¨ {𝕏˜}⍟(∊˙⊸=)¨ 𝕗 + as { ! 𝕨 𝕏 _testConsistent_ ≡ b }¨ {𝕏˜}⍟(∊˙⊸=)¨ 𝕗 } RandRep ← -⟜»∘∧ 1⊸+⊸gen.Index⟜⥊ _testIndices ← { # / - (RandRep○RandBound˜ 𝕩)⊸{ ! 𝕏 _testConsistent_ FlatMatch 𝕨 }¨ 𝕗 + (RandRep○RandBound˜ 𝕩)⊸{ ! 𝕏 _testConsistent_ ≡ 𝕨 }¨ 𝕗 } _testSelect ← { # /⊏ l‿sh ← (⍋≠¨)⊸⊏ RandShape¨ 𝕩‿𝕩 @@ -194,8 +194,8 @@ _testSelect ← { # /⊏ 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 }¨ 𝕗 + g { ! (n𝕎 ⊑sh) 𝕏 _testConsistent_ ≡ d }¨ 𝕗 + g { ! (l𝕎¨l≠⊸↑sh) 𝕏 _testConsistent_ ≡ d }¨ 𝕗 } cases ← ⟨ -- cgit v1.2.3