12#define BOOST_TEST_MODULE Test RootSerKeyValueStore
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
36 std::string
str =
"hello";
43 TH1F h1(
"th1name",
"th1name", 100, 0, 99);
44 h1.FillRandom(
"gaus", 10000);
48 BOOST_CHECK(strcmp(std::type_index(
typeid(
double*)).
name(),
"Pd") == 0);
50 BOOST_CHECK(strcmp(std::type_index(
typeid(
unsigned int)).
name(),
"j") == 0);
53 BOOST_CHECK(strcmp(std::type_index(
typeid(
unsigned char)).
name(),
"h") == 0);
57 BOOST_CHECK(strcmp(TClass::GetClass(
typeid(std::vector<double>))->GetName(),
"vector<double>") == 0);
69 auto r1 = s.get<std::string>(
"str",
state);
71 auto returnedstring = s.getRef<std::string>(
"str",
state);
75 auto r2 = s.get<
int>(
"str",
state);
78 auto r3 = s.get<
int>(
"str2",
state);
82 auto r4 = s.get<TH1F>(
"non-existend-histogram",
state);
87 s.put<
int>(
"twice", 10);
88 s.put<
int>(
"twice", 7);
91 std::cerr <<
"TESTING FILE IO\n";
92 TMemFile
f(
"tmp.root",
"RECREATE");
93 f.WriteObject(&s,
"map");
96 f.GetObject(
"map", s2);
99 auto t1 = s2->
get<
double>(
"x");
103 auto i1 = s2->
get<
int>(
"i");
107 auto t2 = s2->
get<std::string>(
"str");
110 auto t3 = s2->
get<std::string>(
"str");
113 auto histo = s2->
get<TH1F>(
"h1");
const T * get(std::string const &key) const
returns object pointer for this key or nullptr if error or does not exist.
void print(bool includetypeinfo=false) const
print list of keys, values (and optionally type information)
GLuint const GLchar * name
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_AUTO_TEST_CASE(write_read_test)