group statistics test

This commit is contained in:
dzaima 2025-03-13 20:41:46 +02:00
parent 233c88120d
commit 82ebd37b3f
2 changed files with 37 additions and 0 deletions

View File

@ -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));

View File

@ -0,0 +1,19 @@
# needs: Singeli & -DTEST_GROUP_STAT
"basic test doesn't work; are you on a -DTEST_GROUP_STAT build?" ! 001109 •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 %% 001109
%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 %% 00110
%USE tvar AllEq {_tvar 𝕩10}¨ 1+1000 %% 001110
%USE tvar {! 0,0,0,𝕩,3 _tvar 𝕩32}¨ 2+1000
%USE tvar {! 0,0,1,𝕩,𝕩-1 _tvar 𝕩}¨ 1+1000
%USE tvar AllEq {a𝕩0 AllEq {0124_tvar 3(𝕩) a}¨ 𝕩-1}¨ 2+40 %% 0003
%USE tvar AllEq {a𝕩0 AllEq { _tvar 9(𝕩) a}¨ 1+𝕩-2}¨ 3+40 %% 00039
%USE tvar AllEq {a𝕩0 AllEq {014_tvar ¯1(𝕩) a}¨ 𝕩}¨ 2+40 %% 010
%USE tvar AllEq {a𝕩0 AllEq {014_tvar 12(𝕩) a}¨ 𝕩}¨ 1+40 %% 0012