diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/Makefile | 28 | ||||
-rw-r--r-- | tests/unit/kernel/logTest.cc | 14 | ||||
-rw-r--r-- | tests/unit/kernel/rtlilTest.cc | 14 |
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/unit/Makefile b/tests/unit/Makefile new file mode 100644 index 000000000..16f65ec20 --- /dev/null +++ b/tests/unit/Makefile @@ -0,0 +1,28 @@ +GTESTFLAG := -lgtest -lgtest_main +RPATH := -Wl,-rpath +EXTRAFLAGS := -lyosys + +ALLTESTFILE := $(wildcard ./**/*Test.cc) +OBJTEST := objtest +BINTEST := bintest + +all: prepare $(ALLTESTFILE:%Test.cc=%Test.o) + +%Test.o: %Test.cc + $(CXX) -o $(OBJTEST)/$(notdir $@) -c -I$(ROOTPATH) $(CPPFLAGS) $(CXXFLAGS) $< + $(CXX) -L$(ROOTPATH) $(RPATH)=$(ROOTPATH) -o \ + $(BINTEST)/$(basename $(notdir $@)) $(OBJTEST)/$(notdir $@) $(LDLIBS) \ + $(GTESTFLAG) $(EXTRAFLAGS) + +.PHONY: prepare run-tests clean + +run-tests: + $(CURDIR)/$(BINTEST)/* + +prepare: + mkdir -p $(OBJTEST) + mkdir -p $(BINTEST) + +clean: + rm -rf $(OBJTEST) + rm -rf $(BINTEST) diff --git a/tests/unit/kernel/logTest.cc b/tests/unit/kernel/logTest.cc new file mode 100644 index 000000000..62b4f3b98 --- /dev/null +++ b/tests/unit/kernel/logTest.cc @@ -0,0 +1,14 @@ +#include <gtest/gtest.h> + +#include "kernel/yosys.h" +#include "kernel/log.h" + +YOSYS_NAMESPACE_BEGIN + +TEST(KernelLogTest, logvValidValues) +{ + //TODO: Implement log test + EXPECT_EQ(7, 7); +} + +YOSYS_NAMESPACE_END diff --git a/tests/unit/kernel/rtlilTest.cc b/tests/unit/kernel/rtlilTest.cc new file mode 100644 index 000000000..d9eeed555 --- /dev/null +++ b/tests/unit/kernel/rtlilTest.cc @@ -0,0 +1,14 @@ +#include <gtest/gtest.h> + +#include "kernel/yosys.h" +#include "kernel/rtlil.h" + +YOSYS_NAMESPACE_BEGIN + +TEST(KernelRtlilTest, getReferenceValid) +{ + //TODO: Implement rtlil test + EXPECT_EQ(33, 33); +} + +YOSYS_NAMESPACE_END |