diff --git a/.common/cpp/makefile b/.common/cpp/makefile index 31bc2b7..9b930ea 100644 --- a/.common/cpp/makefile +++ b/.common/cpp/makefile @@ -1,8 +1,10 @@ CXX=clang++ CXXFLAGS=-std=c++20 -Wall -Wextra -catch2.o: ../.common/catch_amalgamated.cpp ../.common/catch_amalgamated.hpp - $(CXX) $(CXXFLAGS) -g -c ../.common/catch_amalgamated.cpp -o catch2.o +COMMON_PATH=../.common/cpp + +catch2.o: $(COMMON_PATH)/catch_amalgamated.cpp $(COMMON_PATH)/catch_amalgamated.hpp + $(CXX) $(CXXFLAGS) -g -c $(COMMON_PATH)/catch_amalgamated.cpp -o catch2.o %: catch2.o %.cpp $(CXX) $(CXXFLAGS) -DTEST -g $^ -o $@ diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index b56858f..efcfe86 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -8,7 +8,36 @@ void solve() { } // namespace +// for single test case, comment out for ‹N› test cases +#define SINGLE + +#ifndef TEST + int main(void) { + +#ifdef SINGLE + solve(); + +#else + + // for multiple test cases + int N; + std::cin >> N >> std::ws; + + for (auto i = 0; i < N; ++i) { + solve(); + } + +#endif + return 0; } + +#else + +#include "../.common/cpp/catch_amalgamated.hpp" + +// TODO + +#endif \ No newline at end of file