diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/meson.build | 1 | ||||
| -rw-r--r-- | include/tael/context.hh | 79 | ||||
| -rw-r--r-- | include/tael/meson.build | 1 | ||||
| -rw-r--r-- | include/tael/tael.hh | 26 | ||||
| -rw-r--r-- | include/tael/tatl.hh | 26 |
5 files changed, 133 insertions, 0 deletions
diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..5aa9e68 --- /dev/null +++ b/include/meson.build @@ -0,0 +1 @@ +subdir('tael') diff --git a/include/tael/context.hh b/include/tael/context.hh new file mode 100644 index 0000000..338f86b --- /dev/null +++ b/include/tael/context.hh @@ -0,0 +1,79 @@ +/* + * This file is part of Tatl <https://github.com/Fuwn/tatl>. + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * + * 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, version 3. + * + * 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 <http://www.gnu.org/licenses/>. + * + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_CONTEXT +#define TAEL_CONTEXT + +#include <string> + +#include <tatl/context.h> +#include <tatl/context/set.h> + +namespace tael { + +// Hold the tests that a Tael should complete along with data about the Tael +// context +class context { +private: + tatl_context inner_context; + +public: + // Initialise a Tael context with safe defaults; and optionally, with a tag + // and mute state + explicit context(const std::string & = "", bool = false); + ~context(); + // Get the Tael context's total number of tests + std::size_t total() const; + // Get the Tael context's total number of passing tests + std::size_t passed() const; + // Get the Tael context's total number of failing tests + std::size_t failed() const; + // Get the Tael context's tag + const char *tag() const; + // Get the Tael context's mute status + bool mute() const; + // Get the Tael context's exit code + int exit_code() const; + // Set the Tael context's mute status + // + // Muting a Tael context disables any output that the context may produce. + void set_mute(bool); + // Set the Tael context's tag + void set_tag(const std::string &); + // Summarise the Tael context's test results + // + // Called automatically by finish + void summary(); + // Add a test to the Tael context's test queue + void add(const char *, int (*)()); + // Run all tests within the Tael context's test queue + // + // Called automatically by finish + void run(); + // A comprehensive collection of tasks that calls many of the "finishing" Tael + // operations + // + // Calls run and summary---in that order + void finish(); +}; + +} // namespace tael + +#endif // TAEL_CONTEXT diff --git a/include/tael/meson.build b/include/tael/meson.build new file mode 100644 index 0000000..7837a29 --- /dev/null +++ b/include/tael/meson.build @@ -0,0 +1 @@ +project_header_files += files('context.hh', 'tael.hh', 'tatl.hh') diff --git a/include/tael/tael.hh b/include/tael/tael.hh new file mode 100644 index 0000000..862f392 --- /dev/null +++ b/include/tael/tael.hh @@ -0,0 +1,26 @@ +/* + * This file is part of Tatl <https://github.com/Fuwn/tatl>. + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * + * 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, version 3. + * + * 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 <http://www.gnu.org/licenses/>. + * + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_TAEL +#define TAEL_TAEL + +#include <tael/context.hh> + +#endif // TAEL_TAEL diff --git a/include/tael/tatl.hh b/include/tael/tatl.hh new file mode 100644 index 0000000..16a6324 --- /dev/null +++ b/include/tael/tatl.hh @@ -0,0 +1,26 @@ +/* + * This file is part of Tatl <https://github.com/Fuwn/tatl>. + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * + * 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, version 3. + * + * 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 <http://www.gnu.org/licenses/>. + * + * Copyright (C) 2022-2022 Fuwn <[email protected]> + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_TATL +#define TAEL_TATL + +#include <tatl/tatl.h> + +#endif // TAEL_TATL |