some changes in kprint
This commit is contained in:
@@ -9,6 +9,7 @@ void test_all(){
|
||||
test_hash_functions();
|
||||
test_hashtable();
|
||||
test_dtsod();
|
||||
test_kprint_colors();
|
||||
printf("\e[96m--------------------------------------\e[0m\n");
|
||||
}
|
||||
|
||||
@@ -18,7 +19,8 @@ int main(){
|
||||
ktDescriptors_initKerepTypes();
|
||||
ktDescriptors_endInit();
|
||||
printf("\e[97mkerep tests are starting!\n");
|
||||
optime("test_all",1,test_all());
|
||||
// optime("test_all",1,test_all());
|
||||
test_kprint_colors();
|
||||
printf("\e[0m\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
int64 _autoarrVsVector(uint16 blockCount, uint16 blockLength){
|
||||
uint32 count=blockLength*blockCount;
|
||||
printf("\e[94mblock count: %u block length: %u count: %llu\n", blockCount, blockLength, (uint64)count);
|
||||
printf("\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, ({
|
||||
@@ -15,7 +15,7 @@ int64 _autoarrVsVector(uint16 blockCount, uint16 blockLength){
|
||||
for(uint32 i=0; i< count; i++)
|
||||
vec.push_back(i);
|
||||
}));
|
||||
int64 t;
|
||||
int64 t=0;
|
||||
optime("Autoarr_get", 1, ({
|
||||
for(uint32 i=0; i< count; i++)
|
||||
t=Autoarr_get(ar, i);
|
||||
|
||||
47
tests/test_kprint_colors.c
Normal file
47
tests/test_kprint_colors.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "tests.h"
|
||||
#if defined(_WIN32)|| defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define testColor(COLOR) \
|
||||
kprint_setColor(kprint_bgBlack | kprint_fg##COLOR);\
|
||||
printf(#COLOR " ");\
|
||||
kprint_setColor(kprint_bg##COLOR | kprint_fgGray);\
|
||||
printf(#COLOR);\
|
||||
kprint_setColor(kprint_bgBlack | kprint_fgBlack);\
|
||||
printf("\n");
|
||||
|
||||
void test_kprint_colors(){
|
||||
IFWIN(
|
||||
({
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
for(uint8 col=0; col<255; col++){
|
||||
SetConsoleTextAttribute(hConsole, col);
|
||||
printf("%u ",col);
|
||||
}
|
||||
}),
|
||||
({
|
||||
for(uint8 col=0; col<255; col++)
|
||||
printf("\e[%um%u ", col, col);
|
||||
})
|
||||
);
|
||||
printf("\n");
|
||||
|
||||
testColor(Black);
|
||||
testColor(DarkRed);
|
||||
testColor(DarkGreen);
|
||||
testColor(DarkYellow);
|
||||
testColor(DarkBlue);
|
||||
testColor(DarkMagneta);
|
||||
testColor(DarkCyan);
|
||||
testColor(Gray);
|
||||
testColor(DarkGray);
|
||||
testColor(Red);
|
||||
testColor(Green);
|
||||
testColor(Yellow);
|
||||
testColor(Blue);
|
||||
testColor(Magneta);
|
||||
testColor(Cyan);
|
||||
testColor(White);
|
||||
kprint_setColor(kprint_bgBlack | kprint_fgGray);
|
||||
}
|
||||
Reference in New Issue
Block a user