chore(cpp): adjust skeleton and makefile

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-10 09:53:39 +02:00
parent 13413ad429
commit 5013af5dcb
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 33 additions and 2 deletions

View file

@ -1,8 +1,10 @@
CXX=clang++ CXX=clang++
CXXFLAGS=-std=c++20 -Wall -Wextra CXXFLAGS=-std=c++20 -Wall -Wextra
catch2.o: ../.common/catch_amalgamated.cpp ../.common/catch_amalgamated.hpp COMMON_PATH=../.common/cpp
$(CXX) $(CXXFLAGS) -g -c ../.common/catch_amalgamated.cpp -o catch2.o
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 %: catch2.o %.cpp
$(CXX) $(CXXFLAGS) -DTEST -g $^ -o $@ $(CXX) $(CXXFLAGS) -DTEST -g $^ -o $@

View file

@ -8,7 +8,36 @@ void solve() {
} // namespace } // namespace
// for single test case, comment out for N test cases
#define SINGLE
#ifndef TEST
int main(void) { int main(void) {
#ifdef SINGLE
solve(); solve();
#else
// for multiple test cases
int N;
std::cin >> N >> std::ws;
for (auto i = 0; i < N; ++i) {
solve();
}
#endif
return 0; return 0;
} }
#else
#include "../.common/cpp/catch_amalgamated.hpp"
// TODO
#endif