This commit is contained in:
2023-01-20 01:17:52 +06:00
parent c5e1a42eb7
commit 40d1828f2c
4 changed files with 71 additions and 59 deletions

View File

@@ -6,8 +6,7 @@ int main(){
ktDescriptors_beginInit();
ktDescriptors_initKerepTypes();
ktDescriptors_endInit();
kprintf("\e[97mkerep tests are starting!\n");
optime("test_all",1,test_all());
test_all();
ktDescriptors_free();
kprintf("\e[0m\n");
return 0;

View File

@@ -7,34 +7,28 @@ int64 _autoarrVsVector(uint16 blockCount, uint16 blockLength){
kprintf("\e[94mblock count: %u block length: %u count: " IFWIN("%llu", "%lu") "\n", blockCount, blockLength, (uint64)count);
Autoarr_int64* ar=Autoarr_create(int64, blockCount, blockLength);
std::vector<int64> vec=std::vector<int64>();
optime("Autoarr_add", 1, ({
for(uint32 i=0; i< count; i++)
Autoarr_add(ar, i);
}));
optime("vector_push_back", 1, ({
for(uint32 i=0; i< count; i++)
vec.push_back(i);
}));
optime("Autoarr_add", count,
Autoarr_add(ar, op_i));
optime("vector_push_back", count,
vec.push_back(op_i));
int64 t=0;
optime("Autoarr_get", 1, ({
for(uint32 i=0; i< count; i++)
t=Autoarr_get(ar, i);
}));
optime("vector_get", 1, ({
for(uint32 i=0; i< count; i++)
t=vec[i];
}));
optime("Autoarr_get", count,
t=Autoarr_get(ar, op_i));
optime("vector_get", count,
t=vec[op_i]);
Autoarr_free(ar, true);
return t;
}
void test_autoarrVsVector(){
kprintf("\e[96m-------[test_autoarr_vs_vector]-------\n");
_autoarrVsVector(4, 16);
_autoarrVsVector(16, 64);
_autoarrVsVector(32, 32);
_autoarrVsVector(64, 64);
_autoarrVsVector(32, 1024);
_autoarrVsVector(256, 256);
_autoarrVsVector(1024, 1024);
optime(__func__, 1, ({
kprintf("\e[96m-------[test_autoarr_vs_vector]-------\n");
_autoarrVsVector(4, 16);
_autoarrVsVector(16, 64);
_autoarrVsVector(32, 32);
_autoarrVsVector(64, 64);
_autoarrVsVector(32, 1024);
_autoarrVsVector(256, 256);
_autoarrVsVector(1024, 1024);
}));
}

View File

@@ -20,19 +20,22 @@ void test_kprint();
void test_type_system();
inline void test_all(){
test_type_system();
test_string();
test_safethrow();
test_searchtree();
test_autoarr();
test_autoarrVsVector();
test_hash_functions();
test_hashtable();
test_dtsod();
test_rng_algorithms();
test_kprint_colors();
test_kprint();
kprintf("\e[96m--------------------------------------\e[0m\n");
kprintf("\e[97mkerep tests are starting!\n");
optime(__func__, 1, ({
test_type_system();
test_string();
test_safethrow();
test_searchtree();
test_autoarr();
test_autoarrVsVector();
test_hash_functions();
test_hashtable();
test_dtsod();
test_rng_algorithms();
test_kprint_colors();
test_kprint();
kprintf("\e[96m--------------------------------------\e[0m\n");
}));
}
#define PRINT_SIZEOF(T) kprintf("\e[94m" #T " size: \e[96m" IFWIN("%llu", "%lu") "\n", sizeof(T))