Commit 44edc9a0 authored by jkvis's avatar jkvis

Added test framework

parent e59a2cd6
CC = gcc
CFLAGS = -O3 -march=native
CPPFLAGS = -Iinclude/ -Ilib/sais-lite-lcp/ -Wall -Wextra -pedantic
CPPFLAGS = -Iinclude/ -Ilib/sais-lite-lcp/ -DNDEBUG -Wall -Wextra -pedantic
SOURCES = $(shell find src/ -name '*.c')
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
LIBS = $(shell find lib/ -name '*.a')
.PHONY: clean
.PHONY: clean tests
libgesa.a: $(LIBS) $(OBJECTS)
$(MAKE) -wC lib/
ar rcsT $@ $(LIBS) $(OBJECTS)
tests: libgesa.a
$(MAKE) -wC tests/
clean:
rm -f $(OBJECTS) $(DEPS) libgesa.a
......
CXXC = g++
CXXFLAGS = -O0 -march=native
CPPFLAGS = -I../include/ -Wall -Wextra -pedantic
SOURCES = $(shell find . -name '*.cc')
OBJECTS = $(SOURCES:.cc=.o)
DEPS = $(OBJECTS:.o=.d)
TARGET = gesa_test
.PHONY: all clean memory_check
all: $(TARGET)
./$<
memory_check: $(TARGET)
valgrind --leak-check=full ./$<
$(TARGET): $(OBJECTS)
$(CXXC) $(CXXFLAGS) $(CPPFLAGS) $(OBJECTS) -L.. -lgesa -o $@
clean:
rm -f $(OBJECTS) $(TARGET)
-include $(DEPS)
%.o: %.cc
$(CXXC) $(CXXFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<
#include <cassert>
#include <cstdio>
#include <cstdlib>
......@@ -10,7 +11,7 @@ int main(int, char* [])
GESA test;
if (GESA_create(&test, (GESA_char_t*) string, 9) != 0)
if (GESA_create(&test, (GESA_char_t*) string, 8) != 0)
{
fprintf(stderr, "Error GESA_create()\n");
return EXIT_FAILURE;
......@@ -18,5 +19,7 @@ int main(int, char* [])
printf("%s\n", test.string[0]);
GESA_destroy(&test, GESA_KEEP_STRINGS);
return EXIT_SUCCESS;
} // main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment