mirror of
https://gitlab.com/mfocko/Codeforces.git
synced 2024-12-21 15:11:26 +01:00
feat(cpp): unify macros for local testing
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
78e46a06ff
commit
51aa29e572
2 changed files with 12 additions and 7 deletions
|
@ -1,14 +1,14 @@
|
|||
CXX=clang++
|
||||
CXXFLAGS=-std=c++20 -Wall -Wextra
|
||||
|
||||
MACROS ?= -DTEST
|
||||
MACROS ?= -D_MF_TEST
|
||||
|
||||
# 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
|
||||
|
||||
%: %.cpp
|
||||
$(CXX) $(CXXFLAGS) $(MACROS) -DLOCAL -g $^ -o $@
|
||||
$(CXX) $(CXXFLAGS) $(MACROS) -g $^ -o $@
|
||||
|
||||
format:
|
||||
clang-format -i -style=google *.cpp
|
||||
|
|
|
@ -102,7 +102,7 @@ void dbg_out(Head H, Tail... T) {
|
|||
std::cerr << ' ' << H;
|
||||
dbg_out(T...);
|
||||
}
|
||||
#ifdef LOCAL
|
||||
#ifdef _MF_TEST
|
||||
#define dbg(...) \
|
||||
std::cerr << '[' << __FILE__ << ':' << __LINE__ << "] (" << #__VA_ARGS__ \
|
||||
<< "):", \
|
||||
|
@ -265,12 +265,17 @@ std::ostream &operator<<(std::ostream &os, const C &v) {
|
|||
|
||||
template <typename T>
|
||||
inline void answer(const T &ans) {
|
||||
|
||||
#ifdef _MF_TEST
|
||||
std::cout << "Answer: ";
|
||||
#endif
|
||||
|
||||
std::cout << ans << "\n";
|
||||
}
|
||||
|
||||
inline void yes() { std::cout << "YES\n"; }
|
||||
inline void no() { std::cout << "NO\n"; }
|
||||
inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; }
|
||||
inline void yes() { answer("YES"); }
|
||||
inline void no() { answer("NO"); }
|
||||
inline void yesno(bool ans) { answer(ans ? "YES" : "NO"); }
|
||||
#pragma endregion /* output */
|
||||
|
||||
#pragma region rng
|
||||
|
@ -300,7 +305,7 @@ void tests() {
|
|||
|
||||
using namespace solution;
|
||||
|
||||
#ifdef TEST
|
||||
#ifdef _MF_UNIT_TESTS
|
||||
|
||||
int main(void) {
|
||||
tests();
|
||||
|
|
Loading…
Reference in a new issue