diff --git a/Makefile b/Makefile index 0abd9cb..c504181 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,31 @@ -SRC = $(wildcard src/*.c) -DEPS = $(wildcard deps/**/*.c) -LIBS = $(wildcard lib/**/*.c) -OBJS = $(patsubst %.c,%.o,$(DEPS) $(LIBS)) -BINS = $(patsubst src/%,bin/%,$(patsubst %.c,%,$(SRC))) +SRC = $(wildcard src/*.c) +DEPS = $(wildcard deps/**/*.c) +LIBS = $(wildcard lib/**/*.c) +OBJS = $(patsubst %.c,%.o,$(DEPS) $(LIBS)) +BINS = $(patsubst src/%,bin/%,$(patsubst %.c,%,$(SRC))) + +TEST_SRC = $(wildcard test/*.c) +TEST_BINS = $(patsubst test/%,bin/%,$(patsubst %.c,%.test,$(TEST_SRC))) # CFLAGS = -std=c99 -Ideps -Wall -Wno-unused-function -U__STRICT_ANSI__ CFLAGS = -ggdb -std=c99 -Ideps -Ilib -Wall -Wno-unused-function -pedantic -all: $(BINS) +all: $(BINS) $(TEST_BINS) echo "BINS=$(BINS)" + echo "TESTS=$(TEST_BINS)" $(BINS): $(SRC) $(OBJS) $(CC) $(CFLAGS) -o $@ src/$(notdir $@).c $(OBJS) $(LDFLAGS) +$(TEST_BINS): $(TEST_SRC) $(OBJS) + $(CC) $(CFLAGS) -o $@ test/$(notdir $(patsubst %.test,%.c,$@)) $(OBJS) $(LDFLAGS) + %.o: %.c $(CC) $< -c -o $@ $(CFLAGS) clean: $(foreach c, $(BINS), rm -f $(c);) + $(foreach c, $(TEST_BINS), rm -f $(c);) rm -f $(OBJS) diff --git a/test/csv-data-manipulation.c b/test/csv-data-manipulation.c new file mode 100644 index 0000000..e791768 --- /dev/null +++ b/test/csv-data-manipulation.c @@ -0,0 +1,41 @@ + +#include +#include + + /* + CSV * csv; + + printf("%s\n%s\n\n",TITLE, URL); + + csv = csv_create(0, 0); + csv_open(csv, "fixtures/csv-data-manipulation.csv"); + csv_display(csv); + + csv_set(csv, 0, 0, "Column0"); + csv_set(csv, 1, 1, "100"); + csv_set(csv, 2, 2, "200"); + csv_set(csv, 3, 3, "300"); + csv_set(csv, 4, 4, "400"); + csv_display(csv); + + csv_save(csv, "tmp/csv-data-manipulation.result.csv"); + csv_destroy(csv); +*/ + +MU_TEST(test_check) { + mu_check(5 == 7); +} + +MU_TEST_SUITE(test_suite) { + MU_RUN_TEST(test_check); +} + +/** + * Test + */ +int main(int argc, char ** argv) { + MU_RUN_SUITE(test_suite); + MU_REPORT(); + return 0; +} +