chore(cpp): don't use Catch2 to allow faster iterations

* Also rework the way ‹main› is done

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-29 15:59:06 +02:00
parent 17e43f0ebf
commit f6e3929fee
Signed by: mfocko
GPG key ID: 7C47D46246790496
2 changed files with 22 additions and 21 deletions

View file

@ -1,13 +1,14 @@
CXX=clang++ CXX=clang++
CXXFLAGS=-std=c++20 -Wall -Wextra 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 # COMMON_PATH=../.common/cpp
$(CXX) $(CXXFLAGS) -g -c $(COMMON_PATH)/catch_amalgamated.cpp -o $(COMMON_PATH)/catch2.o # $(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 %: %.cpp
$(CXX) $(CXXFLAGS) -DTEST -g $^ -o $@ $(CXX) $(CXXFLAGS) $(MACROS) -DLOCAL -g $^ -o $@
format: format:
clang-format -i -style=google *.cpp clang-format -i -style=google *.cpp

View file

@ -78,6 +78,12 @@ using namespace std;
void solve() { void solve() {
// TODO // TODO
dbg("Hello from debug");
answer("Hello");
}
void tests() {
// TODO
} }
} // namespace solution } // namespace solution
@ -86,32 +92,26 @@ using namespace solution;
#ifdef TEST #ifdef TEST
#include "../.common/cpp/catch_amalgamated.hpp" int main(void) {
tests();
TEST_CASE("examples") { return 0;
// TODO
} }
#else #else
int main(void) { int main(void) {
int N = 1;
#ifdef SINGLE #ifndef SINGLE
solution::solve(); std::cin >> N;
#else
// for multiple test cases
int N;
std::cin >> N >> std::ws;
for (auto i = 0; i < N; ++i) {
solution::solve();
}
#endif #endif
while (N-- > 0) {
solve();
}
return 0; return 0;
} }