update Makefile
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
|
||||
NAME_TEST=is_good
|
||||
CC=gcc
|
||||
LDFLAGS=-lpthread -D DEBUG=1
|
||||
LDFLAGS=-lpthread #-D DEBUG=1
|
||||
ROOT_DIR=$(shell pwd)
|
||||
INCLUDE_DIR=$(ROOT_DIR)/src
|
||||
CFLAGS=-I$(INCLUDE_DIR)
|
||||
SRC_DIR=$(ROOT_DIR)/src
|
||||
SRC=$(wildcard */*/*.c)
|
||||
#SRC=$(wildcard */*/*.c)
|
||||
SRC=$(wildcard **/**/*.c)
|
||||
OBJ=$(SRC:.c=.o)
|
||||
#HEADS=$(OBJS:.o=.h)
|
||||
TEST_DIR=$(ROOT_DIR)/test
|
||||
@@ -51,7 +52,9 @@ $(BPROGRESSRC_0): $(BPROGRESSRC)
|
||||
.PHONY: clean mrproper
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
echo "all src : $(SRC)"
|
||||
echo "all obj : $(OBJ)"
|
||||
rm -f $(OBJ)
|
||||
|
||||
mrproper: clean
|
||||
rm -f $(EXEC)
|
||||
|
||||
@@ -1,34 +1,6 @@
|
||||
#include "ftest/ftest.h"
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* check if dir path is empty !
|
||||
* 1 == it is empty,0 it is not empty
|
||||
*/
|
||||
|
||||
int dir_empty(const char *path)
|
||||
{
|
||||
struct dirent *ent;
|
||||
int ret = 1;
|
||||
|
||||
DIR *d = opendir(path);
|
||||
if (!d) {
|
||||
fprintf(stderr, "%s: ", path);
|
||||
perror("");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((ent = readdir(d))) {
|
||||
if (!strcmp(ent->d_name, ".") || !(strcmp(ent->d_name, "..")))
|
||||
continue;
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* by default display in millisecond
|
||||
*/
|
||||
@@ -783,64 +755,7 @@ unsigned nnsleep(long long x) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
void progress_test_(){
|
||||
struct func *tmp;
|
||||
size_t num_test=0;
|
||||
int cur = 0, len;
|
||||
//get_cursor_position(&col, &row);
|
||||
int width;
|
||||
long int chg=0;
|
||||
|
||||
char prgss[]="\\|/-";
|
||||
struct winsize w;
|
||||
//ioctl(1,TIOCGWINSZ, &w); // 1 =STDOUT_FILENO
|
||||
//printf ("lines %d\n", w.ws_row);
|
||||
//width = w.ws_col - 50;
|
||||
//printf ("columns %d vs width.choice: %d\n", w.ws_col, width);
|
||||
|
||||
len=strlen(prgss);
|
||||
|
||||
do{
|
||||
ioctl(1,TIOCGWINSZ, &w); // 1 =STDOUT_FILENO
|
||||
width = w.ws_col - 50;
|
||||
//LOCK(mut_current_test);
|
||||
tmp = current_fn;
|
||||
//UNLOCK(mut_current_test);
|
||||
if(tmp)
|
||||
num_test = extract_num__f(tmp->name);
|
||||
//gotoxy(13,0);
|
||||
printf("\r(%c)[",prgss[cur]);
|
||||
|
||||
for(int i=0; i< width; ++i) {
|
||||
if(i<=(num_test+1)*width/count_tests){
|
||||
//usleep(20000);
|
||||
printf("#");
|
||||
}
|
||||
else printf(".");
|
||||
}
|
||||
printf("|%3ld%%, test N° %ld/%ld]",(num_test+1)*100/count_tests,num_test,count_tests-1);
|
||||
fflush(stdout);
|
||||
|
||||
|
||||
//printf("%c",prgss[cur]);
|
||||
//printf("\33[2K\r"); // remove current line and go to begin of the current line
|
||||
//if(chg==40000){
|
||||
chg=0;
|
||||
if(cur<len-1) ++cur;
|
||||
else cur=0;
|
||||
//}else ++chg;
|
||||
//printf("\n");
|
||||
//sleep(1);
|
||||
//usleep(500000);
|
||||
nnsleep(200000000);// 200 milliseconds
|
||||
}while(tmp);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void bar_progress_test_(){
|
||||
bar_progress_start();
|
||||
@@ -1407,10 +1322,6 @@ __attribute__((destructor))
|
||||
void
|
||||
purge_tests()
|
||||
{
|
||||
/*if(savelog){
|
||||
fclose(f_savelog);
|
||||
PRINT_DEBUG("%s\n","close f_savelog done");
|
||||
}*/
|
||||
struct func *tmp = f_beging;
|
||||
clear_all_func(&tmp);
|
||||
PRINT_DEBUG("%s\n","purge done");
|
||||
|
||||
-157
@@ -1,157 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// for sleep !
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#elif _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "ftest/ftest.h"
|
||||
|
||||
#include "permutation_t/permutation_t.h"
|
||||
|
||||
TEST(size_permutation2){
|
||||
PRINTF("another size_permutation2 again\n");
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
|
||||
TEST(size_permutation)
|
||||
{
|
||||
PERMUTATION_TYPE_CHAR *p = CREATE_PERMUTATION_TYPE_CHAR(3);
|
||||
|
||||
PRINTF(" size = %lu \n",p->size);
|
||||
EXPECT_EQ(p->size, 3);
|
||||
PRINTF("test size_permutation2\n");
|
||||
}
|
||||
TEST(size_permutation2){
|
||||
PRINTF("another size_permutation2 again false\n");
|
||||
bool val_bool = false;
|
||||
ASSERT_TRUE(val_bool);
|
||||
}
|
||||
TEST(size_permutation2)
|
||||
{
|
||||
PRINTF("test size_permutation2\n");
|
||||
bool val_bool = true;
|
||||
ASSERT_FALSE(val_bool);
|
||||
/*
|
||||
PERMUTATION_TYPE_CHAR *p = CREATE_PERMUTATION_TYPE_CHAR(3);
|
||||
|
||||
PRINTF(" size = %u \n",p->size);
|
||||
if(p->size == 3) print_OK_with_msg_endl(" FF yeah GOOD test size passed ");
|
||||
else print_KO_with_msg_endl("NOT GOOD test size not passed ");
|
||||
*/
|
||||
}
|
||||
TEST(float_equal){
|
||||
PRINTF("another size_permutation2 float\n");
|
||||
ASSERT_TRUE(true);
|
||||
float a = 1.00001f;
|
||||
float b = 1.00001f;
|
||||
ASSERT_EQ_TYPE_FLOAT(a,b);
|
||||
b=1.0000101f;
|
||||
ASSERT_EQ_TYPE_FLOAT(a,b);
|
||||
ASSERT_EQ_TYPE_FLOAT(1.0000102f,b);
|
||||
}
|
||||
TEST(double_equal){
|
||||
PRINTF("another size_permutation2 double\n");
|
||||
ASSERT_TRUE(true);
|
||||
double a = 1.00000001;
|
||||
double b = 1.00000001;
|
||||
ASSERT_EQ_TYPE_DOUBLE(a,b);
|
||||
b=1.00000001000000001;
|
||||
ASSERT_EQ_TYPE_DOUBLE(a,b);
|
||||
ASSERT_EQ_TYPE_DOUBLE(1.0000000100000002,b);
|
||||
}
|
||||
|
||||
TEST(){
|
||||
unsigned char c = 'a';
|
||||
|
||||
debug_print("another size_permutation2, a = %c\n",c);
|
||||
ASSERT_FALSE(true);
|
||||
ASSERT_TRUE(true);
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(){
|
||||
sleep(3);
|
||||
int a = 5;
|
||||
long b = 5;
|
||||
ASSERT_EQ(a,b);
|
||||
a=4;
|
||||
ASSERT_EQ(a,b);
|
||||
|
||||
}
|
||||
|
||||
TEST(expect){
|
||||
sleep(2);
|
||||
int a = 5;
|
||||
int b = 6;
|
||||
EXPECT_EQ(a,b);
|
||||
//SKIP();
|
||||
SKIP("on skip eq string\n");
|
||||
EXPECT_EQ_TYPE_STRING("hello","hello");
|
||||
float f1 = 1.00019999, f2=1.00019999;
|
||||
EXPECT_EQ_TYPE_FLOAT(f1,f2);
|
||||
|
||||
}
|
||||
|
||||
TEST(){
|
||||
PRINTF("no test, only print\n");
|
||||
}
|
||||
|
||||
TEST(){
|
||||
PRINTF("no test, only print\n");
|
||||
}
|
||||
|
||||
TEST(){
|
||||
PRINTF("no test, only print\n");
|
||||
}
|
||||
|
||||
|
||||
TEST(){
|
||||
|
||||
PERMUTATION_TYPE_CHAR *p_char = CREATE_PERMUTATION_TYPE_CHAR(6);
|
||||
p_char->perm[0]='B';
|
||||
p_char->perm[1]='A';
|
||||
p_char->perm[2]='Y';
|
||||
p_char->perm[3]='C';
|
||||
p_char->perm[4]='D';
|
||||
p_char->perm[5]='Z';
|
||||
|
||||
PERMUTATION_TYPE_SIZE_T *tr_p_char = TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_CHAR(p_char);
|
||||
|
||||
for(int i = 0; i < tr_p_char->size; ++i) PRINTF(" [%d ]%ld ,",i,tr_p_char->perm[i]);
|
||||
PRINTF("p_char == %s\n",p_char->perm);
|
||||
}
|
||||
|
||||
TEST(lessThan){
|
||||
long int a=1,b=2;
|
||||
EXPECT_LT(a,b);
|
||||
EXPECT_LT(b,a);
|
||||
|
||||
}
|
||||
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
TEST(sleep){sleep(2);}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
|
||||
//run_all_tests();
|
||||
//run_all_tests_parallel(4);
|
||||
|
||||
run_all_tests_args(argc, argv);
|
||||
|
||||
//purge_tests();
|
||||
//run_some_tests(8, 1, 2, 2, 3, 3, 0, 4, 1);
|
||||
//run_some_tests(8, 5, 7, 1, 1, 1, 1, 1, 1);
|
||||
//run_some_tests_one_by_one(3, 1, 2, 2);
|
||||
//run_all_tests_exept(2, 1, 3);
|
||||
return 0;
|
||||
}
|
||||
+1
-1
@@ -93,7 +93,7 @@ TEST(expect){
|
||||
int a = 5;
|
||||
int b = 6;
|
||||
EXPECT_EQ(a,b);
|
||||
//SKIP();
|
||||
// SKIP();
|
||||
SKIP("%s\n","on skip eq string");
|
||||
EXPECT_EQ_TYPE_STRING("hello","hello");
|
||||
float f1 = 1.00019999, f2=1.00019999;
|
||||
|
||||
Reference in New Issue
Block a user