diff --git a/.common/cpp/makefile b/.common/cpp/makefile index 0f9f8ba..406956a 100644 --- a/.common/cpp/makefile +++ b/.common/cpp/makefile @@ -1,13 +1,14 @@ CXX=clang++ CXXFLAGS=-std=c++20 -Wall -Wextra -COMMON_PATH=../.common/cpp +MACROS ?= -DTEST -$(COMMON_PATH)/catch2.o: $(COMMON_PATH)/catch_amalgamated.cpp $(COMMON_PATH)/catch_amalgamated.hpp - $(CXX) $(CXXFLAGS) -g -c $(COMMON_PATH)/catch_amalgamated.cpp -o $(COMMON_PATH)/catch2.o +# COMMON_PATH=../.common/cpp +# $(COMMON_PATH)/catch2.o: $(COMMON_PATH)/catch_amalgamated.cpp $(COMMON_PATH)/catch_amalgamated.hpp +# $(CXX) $(CXXFLAGS) -g -c $(COMMON_PATH)/catch_amalgamated.cpp -o $(COMMON_PATH)/catch2.o -%: $(COMMON_PATH)/catch2.o %.cpp - $(CXX) $(CXXFLAGS) -DTEST -g $^ -o $@ +%: %.cpp + $(CXX) $(CXXFLAGS) $(MACROS) -DLOCAL -g $^ -o $@ format: clang-format -i -style=google *.cpp diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 0e0fc71..8202982 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -78,6 +78,12 @@ using namespace std; void solve() { // TODO + dbg("Hello from debug"); + answer("Hello"); +} + +void tests() { + // TODO } } // namespace solution @@ -86,32 +92,26 @@ using namespace solution; #ifdef TEST -#include "../.common/cpp/catch_amalgamated.hpp" - -TEST_CASE("examples") { - // TODO +int main(void) { + tests(); + return 0; } #else int main(void) { + int N = 1; -#ifdef SINGLE +#ifndef SINGLE - solution::solve(); - -#else - - // for multiple test cases - int N; - std::cin >> N >> std::ws; - - for (auto i = 0; i < N; ++i) { - solution::solve(); - } + std::cin >> N; #endif + while (N-- > 0) { + solve(); + } + return 0; }