libmrbesen/tests/main.cpp

54 lines
1.4 KiB
C++
Raw Permalink 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();
2021-02-07 21:25:58 +01:00
int testFiles_iterateFile();
2020-10-02 15:54:12 +02:00
int testFiles_scan();
2020-10-08 10:34:12 +02:00
int testFiles_readFile();
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-10-04 15:03:06 +02:00
int testUtil_trim();
2020-10-08 18:55:55 +02:00
int testUtil_trimOnce();
2020-10-05 13:35:42 +02:00
int testUtil_base();
2020-11-03 16:11:41 +01:00
int testUtil_replace();
2020-11-03 18:52:57 +01:00
int testUtil_replace2();
2020-09-28 23:49:14 +02:00
2020-10-04 15:03:06 +02:00
int testStringSpliterator();
int testUtilSplit();
2020-10-07 13:03:07 +02:00
int testGetDoy();
2021-02-07 21:25:58 +01:00
test_t tests[] = {testFiles_parent, testFiles_file, testFiles_extention, testFiles_iterateFile, testFiles_scan, testFiles_readFile,
2020-11-03 18:52:57 +01:00
testUtil_Count, testUtil_equalsIgnoreCase, testUtil_toLower, testUtil_start_endWith, testUtil_removeStart_End, testUtil_insertStart_End, testUtil_trim, testUtil_trimOnce, testUtil_base, testUtil_replace, testUtil_replace2,
2020-10-04 15:03:06 +02:00
testStringSpliterator, testUtilSplit,
2020-10-07 13:03:07 +02:00
testGetDoy,
2020-10-04 15:03:06 +02:00
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;
}