core: make SizeCounter use pointer instead of reference
Restore virtual inheritance of GenericLinkServiceCounters in
GenericLinkService
refs #3941
Change-Id: I368e4694fee7bc97173fddfc81d0c679da0d6eed
diff --git a/tests/core/counter.t.cpp b/tests/core/counter.t.cpp
index 310e589..ce9a086 100644
--- a/tests/core/counter.t.cpp
+++ b/tests/core/counter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -69,16 +69,22 @@
BOOST_AUTO_TEST_CASE(SizeCnt)
{
std::vector<int> v;
- SizeCounter<std::vector<int>> counter(v);
+ SizeCounter<std::vector<int>> counter1(&v);
+ SizeCounter<std::vector<int>> counter2;
+ counter2.observe(&v);
- size_t observation = counter; // implicit conversion
- BOOST_CHECK_EQUAL(observation, 0);
+ size_t observation1 = counter1; // implicit conversion
+ size_t observation2 = counter2;
+ BOOST_CHECK_EQUAL(observation1, 0);
+ BOOST_CHECK_EQUAL(observation2, 0);
v.resize(249);
- BOOST_CHECK_EQUAL(counter, 249);
+ BOOST_CHECK_EQUAL(counter1, 249);
+ BOOST_CHECK_EQUAL(counter2, 249);
v.resize(98);
- BOOST_CHECK_EQUAL(counter, 98);
+ BOOST_CHECK_EQUAL(counter1, 98);
+ BOOST_CHECK_EQUAL(counter2, 98);
}
BOOST_AUTO_TEST_SUITE_END() // TestCounter