Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Test.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
16#include "Test.hpp"
19
20namespace shamtest::details {
21
22 TestResult current_test{Unittest, "", 0};
23
25
26 using namespace shamsys::instance;
27
28 if (node_count != -1) {
31 "trying to run a test with wrong number of nodes");
32 }
33 }
34
36
37 try {
39 } catch (const std::exception &e) {
40 current_test.asserts.assert_add_comment("exception_thrown", false, e.what());
41 }
42
43 return std::move(current_test);
44 }
45
46} // namespace shamtest::details
Header file describing a Node Instance.
std::uint32_t u32
32 bit unsigned integer
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
Definition worldInfo.cpp:40
i32 world_size()
Gives the size of the MPI communicator.
Definition worldInfo.cpp:38
implementation details of the test library
Definition DataNode.hpp:23
TestResult current_test
Current test being run.
Definition Test.cpp:22
void assert_add_comment(std::string assert_name, bool v, std::string comment, SourceLocation loc=SourceLocation{})
add an assertion with a comment
i32 node_count
Node count of the test.
Definition Test.hpp:29
TestResult run()
Run the test.
Definition Test.cpp:24
void(* test_functor)()
Test function.
Definition Test.hpp:30
std::string name
Name of the test.
Definition Test.hpp:28
TestType type
Type of test.
Definition Test.hpp:27