mirror of
https://gitlab.com/mfocko/Codeforces.git
synced 2024-11-09 13:49:06 +01:00
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:
parent
17e43f0ebf
commit
f6e3929fee
2 changed files with 22 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue