Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
TestData.hpp
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
10#pragma once
11
19
20namespace shamtest::details {
21
23 struct TestData {
24 std::string dataset_name;
25 std::vector<DataNode> dataset;
26
28 inline void add_data(std::string name, const std::vector<f64> &v) {
29 std::vector<f64> new_vec;
30 for (f64 f : v) {
31 new_vec.push_back(f);
32 }
33 dataset.push_back(DataNode{std::move(name), std::move(new_vec)});
34 }
35
37 std::string serialize_json();
39 void serialize(std::basic_stringstream<byte> &stream);
41 static TestData deserialize(std::basic_stringstream<byte> &stream);
42 };
43
44} // namespace shamtest::details
This file hold the definitions for a test DataNode.
double f64
Alias for double.
implementation details of the test library
Definition DataNode.hpp:23
Data node generated by the test.
Definition DataNode.hpp:26
static TestData deserialize(std::basic_stringstream< byte > &stream)
DeSerialize the assertion from binary format.
void add_data(std::string name, const std::vector< f64 > &v)
Add some data to the dataset.
Definition TestData.hpp:28
std::string serialize_json()
Serialize the assertion in JSON.
std::vector< DataNode > dataset
Dataset.
Definition TestData.hpp:25
std::string dataset_name
Name of the dataset.
Definition TestData.hpp:24
void serialize(std::basic_stringstream< byte > &stream)
Serialize the assertion in binary format.