From fddc548fbb1d167e05b8169d5c1ab3c4a5928ced Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 10 Jul 2023 14:23:09 +0200 Subject: [PATCH] chore(cpp): update skeleton Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 6f4ee9e..d39ba41 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -1,18 +1,28 @@ #include -namespace { +namespace helpers { using namespace std; long pow(long base, long exp) { - if (exp == 0) - return 1; + if (exp == 0) return 1; long half = pow(base, exp / 2); - if (exp % 2 == 0) - return half * half; + if (exp % 2 == 0) return half * half; return half * half * base; } +template +inline void answer(const T &ans) { + cout << ans << "\n"; +} + +} // namespace helpers + +namespace { + +using namespace std; +using namespace helpers; + void solve() { // TODO } @@ -22,7 +32,15 @@ void solve() { // for single test case, comment out for ‹N› test cases #define SINGLE -#ifndef TEST +#ifdef TEST + +#include "../.common/cpp/catch_amalgamated.hpp" + +TEST_CASE("examples") { + // TODO +} + +#else int main(void) { @@ -45,10 +63,4 @@ int main(void) { return 0; } -#else - -#include "../.common/cpp/catch_amalgamated.hpp" - -// TODO - -#endif \ No newline at end of file +#endif