removed incomplete c++ code
This commit is contained in:
@@ -8,8 +8,6 @@ void test_all(){
|
||||
test_hash_functions();
|
||||
test_hashtable();
|
||||
test_dtsod();
|
||||
test_autoarr2();
|
||||
// test_hashtable2();
|
||||
printf("\e[96m--------------------------------------\e[0m\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#include "tests.h"
|
||||
#include "../src/Autoarr2/Autoarr2.hpp"
|
||||
|
||||
|
||||
#define maxlength 160
|
||||
|
||||
void printautoarr2(Autoarr2<uint16>* ar){
|
||||
printf("\e[94mAutoarr2<uint16>: "
|
||||
IFWIN("%llu", "%lu")
|
||||
"\n blocks_count: %u\n"
|
||||
" max_block_length: %u\n"
|
||||
" block_length: %u\n"
|
||||
" length: %u\n",
|
||||
sizeof(Autoarr2<uint16>),
|
||||
ar->blocks_count,
|
||||
ar->max_block_length,
|
||||
ar->block_length,
|
||||
ar->length);
|
||||
}
|
||||
|
||||
void fillar2(Autoarr2<uint16>* ar){
|
||||
for (uint16 i=0;i<maxlength;i++)
|
||||
ar->add(i);
|
||||
}
|
||||
void resetar2(Autoarr2<uint16>* ar){
|
||||
for (uint16 i=0;i<maxlength;i++)
|
||||
ar->set(i,maxlength-i-1);
|
||||
}
|
||||
|
||||
void printallval2(Autoarr2<uint16>* ar){
|
||||
printf("\e[90m");
|
||||
for (uint16 i=0;i<ar->length;i++)
|
||||
printf("%u ",ar->get(i));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void test_autoarr2(){
|
||||
optime("test_autoarr2",1,({
|
||||
printf("\e[96m------------[test_autoarr2]-----------\n");
|
||||
Autoarr2<uint16>* ar=new Autoarr2<uint16>(16);
|
||||
printf("\e[92mautoarr2 created\n");
|
||||
fillar2(ar);
|
||||
printf("\e[92mautoarr2 filled up\n");
|
||||
printautoarr2(ar);
|
||||
printallval2(ar);
|
||||
resetar2(ar);
|
||||
printf("\e[92mautoarr2 values reset\n");
|
||||
printallval2(ar);
|
||||
delete ar;
|
||||
printf("\e[92mautoarr2 deleted\n");
|
||||
}));
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "tests.h"
|
||||
#include "../src/Hashtable2/Hashtable2.hpp"
|
||||
#include <memory>
|
||||
|
||||
#define TKey std::shared_ptr<char>
|
||||
#define TVal uint64
|
||||
#define HT_TYPE Hashtable2<TKey, TVal>
|
||||
#define HT_TYPE_NAME "Hashtable2<std::shared_ptr<char*>, uint64>"
|
||||
|
||||
void print_hashtable(HT_TYPE* ht){
|
||||
printf("\e[94m" HT_TYPE_NAME ": "
|
||||
IFWIN("%llu", "%lu")
|
||||
"\n height: %u\n",
|
||||
sizeof(HT_TYPE),
|
||||
ht->height);
|
||||
}
|
||||
|
||||
std::shared_ptr<char> genkey(uint32 i){
|
||||
char* key=new char[24];
|
||||
IFMSC(
|
||||
sprintf_s(key,24,"key_%u",i),
|
||||
sprintf(key,"key_%u",i)
|
||||
);
|
||||
dbg(i);
|
||||
return std::shared_ptr<char>(key, [](char* s){ delete[] s;});
|
||||
}
|
||||
|
||||
void fill(HT_TYPE* ht){
|
||||
for(uint32 i=0;i<260;i++)
|
||||
ht->add(genkey(i), 555666);
|
||||
print_hashtable(ht);
|
||||
}
|
||||
|
||||
TVal gett(HT_TYPE* ht){
|
||||
TVal u;
|
||||
for(uint32 i=0;i<1000;i++){
|
||||
TKey key=genkey(i);
|
||||
u=ht->get(key);
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
void test_hashtable2(){
|
||||
//optime("test_hashtable2",1,({
|
||||
printf("\e[96m-----------[test_hashtable2]-----------\n");
|
||||
#if STORE_HASHES
|
||||
HT_TYPE* ht=new HT_TYPE(
|
||||
[](TKey k) { return hashs(hash_sdbm32,k.get()); });
|
||||
#else
|
||||
HT_TYPE* ht=new HT_TYPE(
|
||||
[](TKey k) -> HT_HASH_T { return hashs(hash_sdbm32,k.get()); },
|
||||
[](TKey k0, TKey k1) -> bool { return cptr_compare(k0.get(), k1.get()); });
|
||||
#endif
|
||||
printf("\e[92mhashtable created\n");
|
||||
print_hashtable(ht);
|
||||
optime("fill",1,fill(ht));
|
||||
// TVal r;
|
||||
// optime("get",1,r=gett(ht));
|
||||
// dbg((uint32)r);
|
||||
// print_hashtable(ht);
|
||||
delete ht;
|
||||
printf("\e[92mhashtable deleted\n");
|
||||
//}));
|
||||
}
|
||||
@@ -10,10 +10,8 @@ void test_string();
|
||||
void test_safethrow();
|
||||
void test_searchtree();
|
||||
void test_autoarr();
|
||||
void test_autoarr2();
|
||||
void test_hash_functions();
|
||||
void test_hashtable();
|
||||
void test_hashtable2();
|
||||
void test_dtsod();
|
||||
|
||||
#if __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user