From d5ba4ae5235334d6f4898fdc7ab721c29d09d3f6 Mon Sep 17 00:00:00 2001 From: Alexey Fedoseev Date: Mon, 22 Apr 2024 21:49:57 +0300 Subject: [PATCH] add useful functions for testing programs --- tests/05-change-doc-name.cpp | 5 +---- tests/testutils.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 tests/testutils.h diff --git a/tests/05-change-doc-name.cpp b/tests/05-change-doc-name.cpp index 18f6a3c..61d139a 100644 --- a/tests/05-change-doc-name.cpp +++ b/tests/05-change-doc-name.cpp @@ -21,14 +21,11 @@ #include #include "cyberiadamlpp.h" +#include "testutils.h" using namespace Cyberiada; using namespace std; -#define CYB_ASSERT(q) if (!(q)) { \ - throw AssertException(std::string(__FILE__) + ":" + std::to_string(__LINE__)); \ - } - int main(int argc, char** argv) { Document d; diff --git a/tests/testutils.h b/tests/testutils.h new file mode 100644 index 0000000..5d906ff --- /dev/null +++ b/tests/testutils.h @@ -0,0 +1,29 @@ +/* ----------------------------------------------------------------------------- + * The Cyberiada GraphML C++ library implemention + * + * The test + * + * Copyright (C) 2024 Alexey Fedoseev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/ + * ----------------------------------------------------------------------------- */ + +#ifndef CYBERIADA_TEST_UTILS +#define CYBERIADA_TEST_UTILS + +#define CYB_ASSERT(q) if (!(q)) { \ + throw AssertException(std::string(__FILE__) + ":" + std::to_string(__LINE__)); \ + } + +#endif