Migrate to latest project structure
This commit is contained in:
@ -1,51 +0,0 @@
|
||||
include ../premake.make
|
||||
LDLIBS += -lboost_unit_test_framework
|
||||
|
||||
BIN := $(shell basename $$(pwd))
|
||||
|
||||
SRCS := $(notdir $(wildcard src/*.cpp))
|
||||
SRCS += $(notdir $(filter-out ../src/main.cpp,$(wildcard ../src/*.cpp)))
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
DEPS := $(SRCS:.cpp=.d)
|
||||
|
||||
BUILDDIR := build/intermediates/
|
||||
|
||||
CXX ?= g++
|
||||
RM := /bin/rm -rf
|
||||
INSTALL := /usr/bin/install -c
|
||||
|
||||
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -I../src
|
||||
ifeq ($(DEBUG),1)
|
||||
CXXFLAGS += -D DEBUG -O0
|
||||
CONFIG := debug
|
||||
else
|
||||
CXXFLAGS += -D NDEBUG -O3
|
||||
CONFIG := release
|
||||
endif
|
||||
OUTDIR := build/$(CONFIG)/
|
||||
|
||||
vpath %.cpp src ../src
|
||||
vpath %.d $(BUILDDIR)
|
||||
vpath %.o $(BUILDDIR)
|
||||
|
||||
.PHONY: all clean prebuild
|
||||
|
||||
all: prebuild $(OUTDIR)$(BIN)
|
||||
|
||||
prebuild:
|
||||
@mkdir -p $(BUILDDIR) $(OUTDIR)
|
||||
|
||||
$(OUTDIR)$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(addprefix $(BUILDDIR),$(OBJS)) $(LDFLAGS) $(LDLIBS) -o $(OUTDIR)$(BIN)
|
||||
@ln -sf $(OUTDIR)$(BIN) $(BIN)
|
||||
|
||||
%.o: %.cpp %.d
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||||
@mv $@ $*.d $(BUILDDIR)
|
||||
|
||||
-include $(BUILDDIR)*.d
|
||||
|
||||
%.d: ;
|
||||
|
||||
clean:
|
||||
$(RM) build $(BIN)
|
1
tests/Makefile
Symbolic link
1
tests/Makefile
Symbolic link
@ -0,0 +1 @@
|
||||
../Makefile
|
6
tests/postmake.make
Normal file
6
tests/postmake.make
Normal file
@ -0,0 +1,6 @@
|
||||
$(BUILDDIR)/%.o: ../src/%.cpp
|
||||
ifeq ($(PRECOMPILE), 1)
|
||||
$(CXX) $(CXXFLAGS) -o $@ -include precomp.hpp -MMD -MP -MT $@ -MF $(BUILDDIR)/$*.dep -c $<
|
||||
else
|
||||
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $(BUILDDIR)/$*.dep -c $<
|
||||
endif
|
5
tests/premake.make
Normal file
5
tests/premake.make
Normal file
@ -0,0 +1,5 @@
|
||||
include ../premake.make
|
||||
LDLIBS += -lboost_unit_test_framework
|
||||
CXXFLAGS += -I../src
|
||||
SRCS := $(notdir $(filter-out ../src/main.cpp,$(wildcard ../src/*.cpp)))
|
||||
PRODUCT := tool
|
@ -1,96 +1,8 @@
|
||||
#define BOOST_TEST_MODULE LibScreensaverTest
|
||||
#define BOOST_TEST_MODULE My Test
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "../../src/Color.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_red_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 0.0; // red
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
BOOST_TEST(rgb.r == 1.0);
|
||||
BOOST_TEST(rgb.g == 0.0);
|
||||
BOOST_TEST(rgb.b == 0.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_yellow_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 60.0; // yellow
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
// yellow = red + green
|
||||
BOOST_TEST(rgb.r == 1.0);
|
||||
BOOST_TEST(rgb.g == 1.0);
|
||||
BOOST_TEST(rgb.b == 0.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_green_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 120.0; // green
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
BOOST_TEST(rgb.r == 0.0);
|
||||
BOOST_TEST(rgb.g == 1.0);
|
||||
BOOST_TEST(rgb.b == 0.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_cyan_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 180.0; //
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
// cyan = green + blue
|
||||
BOOST_TEST(rgb.r == 0.0);
|
||||
BOOST_TEST(rgb.g == 1.0);
|
||||
BOOST_TEST(rgb.b == 1.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_blue_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 240.0; // blue
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
BOOST_TEST(rgb.r == 0.0);
|
||||
BOOST_TEST(rgb.g == 0.0);
|
||||
BOOST_TEST(rgb.b == 1.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hsb2rgb_magenta_test) {
|
||||
HSB hsb;
|
||||
hsb.h = 300.0; // magenta
|
||||
hsb.s = 1.0;
|
||||
hsb.b = 1.0;
|
||||
|
||||
Color col {hsb};
|
||||
RGB rgb {RGB(col)};
|
||||
|
||||
// magenta = red + blue
|
||||
BOOST_TEST(rgb.r == 1.0);
|
||||
BOOST_TEST(rgb.g == 0.0);
|
||||
BOOST_TEST(rgb.b == 1.0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(hextest) {
|
||||
Color col {"#123456"};
|
||||
BOOST_TEST(col.hex() == "#123456");
|
||||
BOOST_AUTO_TEST_CASE(first_test)
|
||||
{
|
||||
BOOST_TEST(1 == 1);
|
||||
}
|
||||
|
1
tests/src/precomp.hpp
Symbolic link
1
tests/src/precomp.hpp
Symbolic link
@ -0,0 +1 @@
|
||||
../../src/precomp.hpp
|
Reference in New Issue
Block a user