From 58688c8090afea95a92a147e26ad0392c1bfef14 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 19 Jun 2022 20:04:56 -0700 Subject: feat: initial commit --- include/meson.build | 1 + include/tael/context.hh | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ include/tael/meson.build | 1 + include/tael/tael.hh | 26 ++++++++++++++++ include/tael/tatl.hh | 26 ++++++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 include/meson.build create mode 100644 include/tael/context.hh create mode 100644 include/tael/meson.build create mode 100644 include/tael/tael.hh create mode 100644 include/tael/tatl.hh (limited to 'include') 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 . + * Copyright (C) 2022-2022 Fuwn + * + * 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 . + * + * Copyright (C) 2022-2022 Fuwn + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_CONTEXT +#define TAEL_CONTEXT + +#include + +#include +#include + +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 . + * Copyright (C) 2022-2022 Fuwn + * + * 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 . + * + * Copyright (C) 2022-2022 Fuwn + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_TAEL +#define TAEL_TAEL + +#include + +#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 . + * Copyright (C) 2022-2022 Fuwn + * + * 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 . + * + * Copyright (C) 2022-2022 Fuwn + * SPDX-License-Identifier: GPL-3.0-only + */ + +#ifndef TAEL_TATL +#define TAEL_TATL + +#include + +#endif // TAEL_TATL -- cgit v1.2.3