MCPcopy Create free account
hub / github.com/boostorg/histogram / main

Function main

test/utility_test.cpp:15–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace boost::histogram;
14
15int main() {
16 // vector streaming
17 {
18 std::ostringstream os;
19 std::vector<int> v = {1, 3, 2};
20 os << v;
21 BOOST_TEST_EQ(os.str(), std::string("[ 1 3 2 ]"));
22 }
23
24 // tuple streaming
25 {
26 std::ostringstream os;
27 auto v = std::make_tuple(1, 2.5, "hi");
28 os << v;
29 BOOST_TEST_EQ(os.str(), std::string("[ 1 2.5 hi ]"));
30 }
31 return boost::report_errors();
32
33 // tracing_allocator
34 {
35 tracing_allocator_db db;
36 tracing_allocator<char> a(db);
37 auto p1 = a.allocate(2);
38 a.deallocate(p1, 2);
39 tracing_allocator<int> b(a);
40 auto p2 = b.allocate(3);
41 b.deallocate(p2, 3);
42 BOOST_TEST_EQ(db.size(), 2);
43 BOOST_TEST_EQ(db[typeid(char)].first, 2);
44 BOOST_TEST_EQ(db[typeid(char)].second, 2);
45 BOOST_TEST_EQ(db[typeid(int)].first, 3);
46 BOOST_TEST_EQ(db[typeid(int)].second, 3);
47 }
48}

Callers

nothing calls this directly

Calls 3

allocateMethod · 0.80
deallocateMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected