22 std::string serialize_vec(
const std::vector<f64> &vec) {
23 std::string acc =
"\n[\n";
25 for (
u32 i = 0; i < vec.size(); i++) {
27 if (i < vec.size() - 1) {
37 std::string acc =
"\n{\n";
39 acc += R
"( "name" : ")" + name + "\",\n";
41 acc += R
"( "data" : )"
43 + serialize_vec(
data) +
"\n";
50 shambase::stream_write_string(stream,
name);
51 shambase::stream_write_vector_trivial(stream,
data);
57 shambase::stream_read_string(stream, out.name);
This file hold the definitions for a test DataNode.
std::uint32_t u32
32 bit unsigned integer
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
void stream_read_vector_trivial(std::basic_stringstream< byte > &stream, std::vector< T > &vec)
read a vector from the bytestream Note : this appends read objects to the vector without resetting it
implementation details of the test library
std::string serialize_json()
Serialize the assertion in JSON.
std::string name
Name of the data node.
static DataNode deserialize(std::basic_stringstream< byte > &reader)
DeSerialize the assertion from binary format.
void serialize(std::basic_stringstream< byte > &stream)
Serialize the assertion in binary format.
std::vector< f64 > data
Held data.