diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.clang-tidy | 1 | ||||
-rw-r--r-- | tests/ingen_bench.cpp | 12 | ||||
-rw-r--r-- | tests/ingen_test.cpp | 13 | ||||
-rw-r--r-- | tests/meson.build | 29 | ||||
-rw-r--r-- | tests/test_utils.hpp | 4 |
5 files changed, 20 insertions, 39 deletions
diff --git a/tests/.clang-tidy b/tests/.clang-tidy index fb68f4e4..7e189145 100644 --- a/tests/.clang-tidy +++ b/tests/.clang-tidy @@ -12,5 +12,6 @@ Checks: > -fuchsia-statically-constructed-objects, -google-readability-casting, -google-readability-todo, + -llvm-header-guard, -readability-function-cognitive-complexity, InheritParentConfig: true diff --git a/tests/ingen_bench.cpp b/tests/ingen_bench.cpp index c7eb336c..82fae78d 100644 --- a/tests/ingen_bench.cpp +++ b/tests/ingen_bench.cpp @@ -115,10 +115,10 @@ run(int argc, char** argv) // Run benchmark // TODO: Set up real-time scheduling for this and worker threads - ingen::Clock clock; - const uint32_t n_test_frames = 1 << 20; - const uint32_t block_length = 4096; - const uint64_t t_start = clock.now_microseconds(); + const ingen::Clock clock; + const uint32_t n_test_frames = 1 << 20; + const uint32_t block_length = 4096; + const uint64_t t_start = clock.now_microseconds(); for (uint32_t i = 0; i < n_test_frames; i += block_length) { world->engine()->advance(block_length); world->engine()->run(block_length); @@ -127,8 +127,8 @@ run(int argc, char** argv) const uint64_t t_end = clock.now_microseconds(); // Write log output - std::unique_ptr<FILE, decltype(&fclose)> log{fopen(out_file.c_str(), "a"), - &fclose}; + const std::unique_ptr<FILE, int (*)(FILE*)> log{fopen(out_file.c_str(), "a"), + &fclose}; if (ftell(log.get()) == 0) { fprintf(log.get(), "# n_threads\trun_time\treal_time\n"); } diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index ec89c40c..b1705dfa 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -45,7 +45,6 @@ #include <iostream> #include <map> #include <memory> -#include <sstream> #include <string> #include <utility> @@ -67,8 +66,8 @@ ingen_try(bool cond, const char* msg) FilePath real_file_path(const char* path) { - std::unique_ptr<char, FreeDeleter<char>> real_path{realpath(path, nullptr), - FreeDeleter<char>{}}; + const std::unique_ptr<char, FreeDeleter<char>> real_path{realpath(path, nullptr), + FreeDeleter<char>{}}; return FilePath{real_path.get()}; } @@ -146,7 +145,7 @@ run(int argc, char** argv) *world->interface()); // AtomWriter to serialise responses from the engine - std::shared_ptr<Interface> client(new TestClient(world->log())); + const std::shared_ptr<Interface> client{new TestClient(world->log())}; world->interface()->set_respondee(client); world->engine()->register_client(client); @@ -162,10 +161,10 @@ run(int argc, char** argv) SerdEnv* env = serd_env_new(&cmds_file_uri); cmds->load_file(env, SERD_TURTLE, run_path); - Sord::Node nil; - int n_events = 0; + const Sord::Node nil; + int n_events = 0; for (;; ++n_events) { - std::string subject_str = fmt("msg%1%", n_events); + const std::string subject_str = fmt("msg%1%", n_events); Sord::URI subject(*world->rdf_world(), subject_str, diff --git a/tests/meson.build b/tests/meson.build index 50b78624..2c7f799f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,26 +1,6 @@ # Copyright 2019-2022 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later -############## -# Unit Tests # -############## - -unit_tests = [ -] - -foreach test : unit_tests - test( - test, - executable( - test, - files('tst_@0@.cpp'.format(test)), - cpp_args: cpp_suppressions + platform_defines, - dependencies: [ingen_dep], - ), - suite: 'unit', - ) -endforeach - ##################### # Integration Tests # ##################### @@ -93,10 +73,11 @@ test_env = environment( default_value: lv2dir, internal: 'plugindir', pkgconfig: 'plugindir', - ) + ), ], ), - }) + }, +) foreach test : integration_tests test( @@ -104,8 +85,8 @@ foreach test : integration_tests ingen_test, env: test_env, args: [ - '--load', empty_manifest, - '--execute', files(test + '.ttl'), + ['--load', empty_manifest], + ['--execute', files(test + '.ttl')], ], ) endforeach diff --git a/tests/test_utils.hpp b/tests/test_utils.hpp index 57446ac5..e595b7c8 100644 --- a/tests/test_utils.hpp +++ b/tests/test_utils.hpp @@ -14,13 +14,13 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -// IWYU pragma: no_include "ingen/FilePath.hpp" - #include "ingen/fmt.hpp" #include <iostream> #include <string> +// IWYU pragma: no_include "ingen/FilePath.hpp" + #define EXPECT_TRUE(value) \ do { \ if (!(value)) { \ |