uCBQN/test/cases/fuzz/squeezeValid.bqn

40 lines
1.4 KiB
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### WHOLE-FILE-TEST
# tests if squeeze produces valid results
helpers •args
r helpers.GetRand@
EEqual, ListVariations, ClearRefs, Variation, Unshare, Squeeze, Info •internal
RandVals, vars, spec, specF64 r helpers.Import "utils.bqn"
TestSq0 {a Squeeze 𝕨 Variation 𝕩 ! 1==a ! 0=a a}
{! 01𝕩 TestSq0 0}¨ 5vars
{! " "1𝕩 TestSq0 ""}¨ 5vars
{𝕩 TestSq0 }¨ ListVariations # {𝕩{•Out "Failed fill for "∾𝕨}⍟⊢ 8 ≠ 1↑⎊8 𝕩 TestSq0 ⟨⟩}¨ ListVariations ⟨⟩ # %ALLOW_CATCH
specSpl 5()spec
allSpec specF64 (@+010321271282552563276732768655356553611141101114111) {}+
Do { 𝕊:
at r.Range 8
l 1 + r.Range (at=0)1000300
a l RandVals at
{! a EEqual Squeeze 𝕩 Variation a}¨ ListVariations a
F { 𝕊:
p {r.Range 2? r.Range l; (¯1+l-)(r.Range 2) r.Range (2r.Range 10)l}
b 𝕩˙(p) a
b0 Unshare b
¬b0 EEqual Squeeze b?
•Out "Fail:"
•Out "Array: "•Repr b
•Out "Squeezed: "•Repr Squeeze b
!0
;@
}
F¨ (at5)specSpl
F¨ allSpec
{𝕊: F¨ @+(at5) r.Range 2r.Range (at5)3320}¨ 10
ClearRefs@
}
Do40000 @