a couple more structural compatibility tests

This commit is contained in:
dzaima 2025-05-22 03:52:21 +03:00
parent 81ce43e77f
commit 5915841307

View File

@ -1,8 +1,8 @@
%DEF var V•internal.Variation LV•internal.ListVariations CLR•internal.ClearRefs
%DEF tvar %USE var _tvar {F _𝕣 x: (CLR@) {F 𝕩 V x}¨ LV 𝕩; w F _𝕣 x: (CLR@) (LV 𝕨) {(𝕨 V w) F 𝕩 V x} LV 𝕩}
%DEF eqvar %USE tvar _eqvar {r 𝕨 𝔽 _tvar 𝕩 !•internal.EEqual(r)¨ r r}
%DEF evar %USE tvar _evar {ok{} r𝕨 ok𝔽{𝕊: •CurrentError@} _tvar 𝕩 {okr? !"TEST FAIL: variation didn't error"; ("TEST FAIL: varying error messages" ! 1=)r !r}}
%DEF eqerr %USE eqvar _eqerr {ok{} r𝕨 ok𝔽{𝕊: •CurrentError@} 𝕩 {okr? !"TEST FAIL: case didn't error"; ("TEST FAIL: varying error messages" ! 1=)r !r}}
%DEF eqvar %USE tvar _eqvar {r 𝕨 𝔽 _tvar 𝕩 "failed eqvar"!•internal.EEqual(r)¨ r r}
%DEF evar %USE tvar _evar {ok{} r𝕨 ok𝔽{𝕊: •CurrentError@} _tvar 𝕩 {okr? !"TEST FAIL: variation didn't error"; ("TEST FAIL: varying error messages" ! 1=)r (r)!0}}
%DEF eqerr %USE eqvar _eqerr {ok{} r𝕨 ok𝔽{𝕊: •CurrentError@} 𝕩 {okr? !"TEST FAIL: case didn't error"; ("TEST FAIL: varying error messages" ! 1=)r (r)!0}}
# ¨ & ˘
# !% ⊢⌾(⊢¨) 4 # TODO enable
# !% ⊢⌾(⊢˘) 4 # TODO enable
@ -215,9 +215,10 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
# NaN things
(
%USE eqvar
_test { set Repl _𝕣 exp:
_test_ { set Repl _𝕣_ different exp:
# •Show ⟨"test", set, Repl, exp⟩
bad {}
_res {different? "ok"𝔽; 𝔽}
_mod {exp? 𝔽; {"Expected error!"!bad𝕩𝕩}(bad𝔽{𝕊: •CurrentError@})}
HasMsg {"mismatched result/error message", exp, 𝕨, 𝕩 ! (¬exp) 𝕨𝕩}
@ -225,39 +226,41 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
exp {
@𝕊·: @;
𝕨𝕊0:
(101160) {Repl(𝕨/) 𝕩}_eqvar 1001
"𝔽⌾(a⊸/): Incompatible result elements" HasMsg (10270) {Repl(𝕨/) 𝕩} _mod _eqvar 1001
(101160) {Repl(𝕨/) 𝕩}_res _eqvar 1001
"𝔽⌾(a⊸/): Incompatible result elements" HasMsg (10270) {Repl(𝕨/) 𝕩}_res _mod _eqvar 1001
125 {Repl(𝕨) 𝕩}_eqvar 1001
"𝔽⌾(a⊸⊏): Incompatible result elements" HasMsg 144 {Repl(𝕨) 𝕩} _mod _eqvar 1001
125 {Repl(𝕨) 𝕩}_res _eqvar 1001
"𝔽⌾(a⊸⊏): Incompatible result elements" HasMsg 144 {Repl(𝕨) 𝕩}_res _mod _eqvar 1001
;
𝕨𝕊1:
"⌾: Incompatible result elements in structural Under" HasMsg 122 {Repl(𝕨¨) 𝕩} _mod 010
"⌾: Incompatible result elements in structural Under" HasMsg 122 {Repl(𝕨¨) 𝕩}_res _mod 010
} set
}
Batch { expNativeexpRuntimeGet:
Batch { differentexpNativeexpRuntimeGet:
val Get@
{ 𝕊 rt:
# •Show ⟨"batch", get, val, rt⟩
expNewexpSame {rt? expRuntime; expNative}
rt (Get¨ ) _test expNew
rt (Get¨ 3) _test expNew
rt {𝕊: 3<val} _test expSame
rt ( 3<val) _test expSame
rt (val˙¨ ) _test expSame
rt (Get¨ ) _test_ different expNew
rt (Get¨ 3) _test_ different expNew
rt {𝕊: 3<val} _test_ 0 expSame
rt ( 3<val) _test_ 0 expSame
rt (val˙¨ ) _test_ 0 expSame
}¨ 01
}
ShouldNotBeCalled { 𝕊:
! •Show "I should not be called!"
}
Batch¨
11, 11, 0÷0
11, 11, <0÷0
11, 11, 3,0÷0,4
11, 11, {𝕊: ShouldNotBeCalled}
11, 11, ShouldNotBeCalled˙
11, 11, {𝕊: ShouldNotBeCalled(0÷0)}
11, 11, ShouldNotBeCalled(0÷0)˙
11, 11,
0, 11, 11, 0÷0
0, 11, 11, <0÷0
0, 11, 11, 3,0÷0,4
0, 11, 11, {𝕊: ShouldNotBeCalled}
0, 11, 11, ShouldNotBeCalled˙
0, 11, 11, {𝕊: ShouldNotBeCalled(0÷0)}
0, 11, 11, ShouldNotBeCalled(0÷0)˙
0, 11, 11,
1, 01, 01, {𝕊: 4{𝕩}}
1, 01, 01, {𝕊: (0÷0){𝕩}}
)