group statistics test
This commit is contained in:
parent
233c88120d
commit
82ebd37b3f
@ -283,7 +283,25 @@ B eequal_c2(B t, B w, B x) {
|
|||||||
#if TEST_RANGE
|
#if TEST_RANGE
|
||||||
#include "../utils/calls.h"
|
#include "../utils/calls.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if TEST_GROUP_STAT
|
||||||
|
extern void (*const si_group_statistics_i8)(void*,usz,uint8_t*,usz*,uint8_t*,usz*,int8_t*);
|
||||||
|
extern void (*const si_group_statistics_i16)(void*,usz,uint8_t*,usz*,uint8_t*,usz*,int16_t*);
|
||||||
|
extern void (*const si_group_statistics_i32)(void*,usz,uint8_t*,usz*,uint8_t*,usz*,int32_t*);
|
||||||
|
#endif
|
||||||
B internalTemp_c1(B t, B x) {
|
B internalTemp_c1(B t, B x) {
|
||||||
|
#if TEST_GROUP_STAT
|
||||||
|
u8 bad; usz neg; u8 sort; usz change; i32 max;
|
||||||
|
#define CASE(T) \
|
||||||
|
if (TI(x,elType)==el_##T) { T max_t; si_group_statistics_##T(tyany_ptr(x), IA(x), &bad, &neg, &sort, &change, &max_t); max = max_t; } \
|
||||||
|
else
|
||||||
|
CASE(i8) CASE(i16) CASE(i32)
|
||||||
|
thrM("bad eltype");
|
||||||
|
#undef CASE
|
||||||
|
decG(x);
|
||||||
|
f64* rp; B r = m_f64arrv(&rp, 5);
|
||||||
|
rp[0] = bad; rp[1] = neg; rp[2] = sort; rp[3] = change; rp[4] = max;
|
||||||
|
return r;
|
||||||
|
#endif
|
||||||
#if TEST_RANGE
|
#if TEST_RANGE
|
||||||
i64 buf[2];
|
i64 buf[2];
|
||||||
bool b = getRange_fns[TI(x,elType)](tyany_ptr(x), buf, IA(x));
|
bool b = getRange_fns[TI(x,elType)](tyany_ptr(x), buf, IA(x));
|
||||||
|
|||||||
19
test/cases/build-specific/test_group_stat.bqn
Normal file
19
test/cases/build-specific/test_group_stat.bqn
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# needs: Singeli & -DTEST_GROUP_STAT
|
||||||
|
"basic test doesn't work; are you on a -DTEST_GROUP_STAT build?" ! 0‿0‿1‿10‿9 ≡ •internal.Temp ↕10
|
||||||
|
|
||||||
|
%DEF tvar AllEq←{v←⊑𝕩 ⋄ {𝕩≡v?1;!𝕩‿v}¨ ⥊𝕩 ⋄ v} ⋄ _tvar ← {Sel _𝕣 a: AllEq {Sel •internal.Temp 𝕩•internal.Variation a}¨ ∊⟜"Ai8"‿"Ai16"‿"Ai32"⊸/ •internal.ListVariations •internal.Squeeze a}
|
||||||
|
%USE tvar ⋄ ⊢_tvar ↕10 %% 0‿0‿1‿10‿9
|
||||||
|
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq {⊑_tvar ¯2⌾(𝕩⊸⊑) a}¨ ↕𝕩}¨ 1+↕40 %% 1
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq {⊑_tvar ¯128⌾(𝕩⊸⊑) a}¨ ↕𝕩}¨ 1+↕40 %% 1
|
||||||
|
|
||||||
|
%USE tvar ⋄ AllEq {⊢_tvar 𝕩⥊0}¨ 1+↕1000 %% 0‿0‿1‿1‿0
|
||||||
|
%USE tvar ⋄ AllEq {⊢_tvar 𝕩⥊10}¨ 1+↕1000 %% 0‿0‿1‿1‿10
|
||||||
|
%USE tvar ⋄ {! ⟨0,0,0,𝕩,3⟩ ≡ ⊢_tvar 𝕩⥊3‿2}¨ 2+↕1000
|
||||||
|
%USE tvar ⋄ {! ⟨0,0,1,𝕩,𝕩-1⟩ ≡ ⊢_tvar ↕𝕩}¨ 1+↕1000
|
||||||
|
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq {0‿1‿2‿4⊸⊏_tvar 3⌾(𝕩⊸⊑) a}¨ ↕𝕩-1}¨ 2+↕40 %% 0‿0‿0‿3
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq { ⊢_tvar 9⌾(𝕩⊸⊑) a}¨ 1+↕𝕩-2}¨ 3+↕40 %% 0‿0‿0‿3‿9
|
||||||
|
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq {0‿1‿4⊸⊏_tvar ¯1⌾(𝕩⊸⊑) a}¨ ↕𝕩}¨ 2+↕40 %% 0‿1‿0
|
||||||
|
%USE tvar ⋄ AllEq {a←𝕩⥊0 ⋄ AllEq {0‿1‿4⊸⊏_tvar 12⌾(𝕩⊸⊑) a}¨ ↕𝕩}¨ 1+↕40 %% 0‿0‿12
|
||||||
Loading…
Reference in New Issue
Block a user