diff --git a/Makefile b/Makefile index fc81452..19e4d48 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ dist: $(PACKAGE)-$(VERSION)/src/common.h \ $(PACKAGE)-$(VERSION)/src/parser.h \ $(PACKAGE)-$(VERSION)/src/project.conf \ + $(PACKAGE)-$(VERSION)/tests/define.cpp \ $(PACKAGE)-$(VERSION)/tests/if.cpp \ $(PACKAGE)-$(VERSION)/tests/Makefile \ $(PACKAGE)-$(VERSION)/tests/cpp.sh \ diff --git a/tests/Makefile b/tests/Makefile index 3ada9d6..100ea7e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -TARGETS = if.o +TARGETS = define.o if.o PREFIX = /usr/local DESTDIR = BINDIR = $(PREFIX)/bin @@ -13,14 +13,20 @@ INSTALL = install all: $(TARGETS) +define.o_OBJS = define.o +define.o_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CXXFLAGS) + if.o_OBJS = if.o if.o_CXXFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CXXFLAGS) +define.o: define.cpp cpp.sh + $(CXX) $(define.o_CXXFLAGS) -c define.cpp + if.o: if.cpp cpp.sh $(CXX) $(if.o_CXXFLAGS) -c if.cpp clean: - $(RM) -- $(if.o_OBJS) + $(RM) -- $(define.o_OBJS) $(if.o_OBJS) distclean: clean $(RM) -- $(TARGETS) diff --git a/tests/define.cpp b/tests/define.cpp new file mode 100644 index 0000000..dec4e33 --- /dev/null +++ b/tests/define.cpp @@ -0,0 +1,25 @@ +#ifdef GOOD +#error error +#endif + +#define GOOD 1 + +#ifdef GOOD +#warning good +#else +#error error +#endif + +#ifndef GOOD +#error error +#else +#warning good +#endif + +#undef GOOD + +#ifndef GOOD +#warning good +#else +#error error +#endif diff --git a/tests/define.o b/tests/define.o new file mode 100644 index 0000000..2948242 --- /dev/null +++ b/tests/define.o @@ -0,0 +1 @@ +#define GOOD 1 2 diff --git a/tests/if.o b/tests/if.o new file mode 100644 index 0000000..45e074c --- /dev/null +++ b/tests/if.o @@ -0,0 +1,31 @@ +#if 0 +#warning good +#endif + +#if 1 +#warning good +#else + +#define GOOD 1 +#if GOOD +#warning good +#else +#undef GOOD + +#define GOOD 0 +#if !GOOD +#warning good +#else +#undef GOOD + +#define GOOD 1 +#if 0 +#warning good +#endif +#undef GOOD + +#define GOOD 0 +#if 0 +#warning good +#endif +#undef GOOD diff --git a/tests/project.conf b/tests/project.conf index 6aab9fb..fdf41bb 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -1,8 +1,15 @@ -targets=if.o +targets=define.o,if.o cxx=./cpp.sh cxxflags= dist=Makefile,cpp.sh +[define.o] +type=object +sources=define.cpp + +[define.cpp] +depends=cpp.sh + [if.o] type=object sources=if.cpp