libmrbesen/tests/main.cpp

38 lines
991 B
C++
Raw Normal View History

2020-09-28 23:49:14 +02:00
#include <stdio.h>
#include "test.h"
//tests
int testFiles_parent();
int testFiles_file();
int testFiles_extention();
2020-10-02 15:54:12 +02:00
int testFiles_scan();
2020-09-28 23:49:14 +02:00
int testUtil_Count();
int testUtil_equalsIgnoreCase();
2020-09-29 14:04:19 +02:00
int testUtil_toLower();
2020-09-29 15:12:46 +02:00
int testUtil_start_endWith();
2020-10-01 14:01:54 +02:00
int testUtil_removeStart_End();
2020-10-02 15:54:12 +02:00
int testUtil_insertStart_End();
2020-09-28 23:49:14 +02:00
2020-10-02 15:54:12 +02:00
test_t tests[] = {testFiles_parent, testFiles_file, testFiles_extention, testFiles_scan, testUtil_Count, testUtil_equalsIgnoreCase, testUtil_toLower, testUtil_start_endWith, testUtil_removeStart_End, testUtil_insertStart_End, NULL};
2020-09-28 23:49:14 +02:00
int main(int argc, char** argv) {
test_t* current = tests;
int failcount = 0;
int testcount = 0;
for(; *current; current++) {
testcount++;
2020-10-02 16:02:14 +02:00
printf("\033[1mRunning test number: %02d ", testcount);
2020-09-28 23:49:14 +02:00
if((*current)()) {
printf("\033[1;92msucceeded\033[0;1m!\n");
} else {
printf("\033[1;91mfailed\033[0;1m\n");
failcount++;
}
}
printf("\033[1;93m%d\033[0;1m/%d failed\n", failcount, testcount);
return failcount > 0;
}