CoolProp
8.0.0
An open-source fluid property and humid air property database
src
Tests
CoolProp-Tests-CBOR.cpp
Go to the documentation of this file.
1
// Byte-equivalence gate: the embedded CBOR blob
2
// must decode to exactly the source dev/all_fluids.json (value-equality). Catches
3
// encoder/decoder drift (cbor2/nlohmann version bumps) and staleness.
4
#if defined(ENABLE_CATCH)
5
# include <catch2/catch_all.hpp>
6
# include <fstream>
7
# include <sstream>
8
# include <string>
9
# include "
CoolProp/detail/json.h
"
10
11
extern
"C"
12
{
13
extern
unsigned
char
gall_fluids_CBORData
[];
14
extern
unsigned
int
gall_fluids_CBORSize
;
15
}
16
17
TEST_CASE(
"embedded CBOR decodes to the source all_fluids.json"
,
"[cbor]"
) {
18
nlohmann::json from_blob =
cpjson::from_cbor
(
gall_fluids_CBORData
,
gall_fluids_CBORSize
);
19
std::ifstream f(COOLPROP_ALL_FLUIDS_JSON_PATH, std::ios::binary);
20
REQUIRE(f.good());
21
std::ostringstream ss;
22
ss << f.rdbuf();
23
nlohmann::json from_src =
cpjson::parse
(ss.str());
24
REQUIRE(from_blob == from_src);
25
}
26
#endif
Generated by
1.9.4