comparison base/test/TestById.h @ 1756:043e05c956fb by-id

MSVC fixes
author Chris Cannam
date Sat, 06 Jul 2019 18:12:38 +0100
parents 6d09d68165a4
children
comparison
equal deleted inserted replaced
1752:6d09d68165a4 1756:043e05c956fb
49 // could be different even if they were allocated from 49 // could be different even if they were allocated from
50 // separate pools. 50 // separate pools.
51 A a; 51 A a;
52 X x; 52 X x;
53 if (a.getId().untyped == x.getUntypedId()) { 53 if (a.getId().untyped == x.getUntypedId()) {
54 cerr << "ERROR: a and x have the same id: " << a.getId() << endl; 54 std::cerr << "ERROR: a and x have the same id: " << a.getId()
55 << std::endl;
55 } 56 }
56 QVERIFY(a.getId().untyped != x.getUntypedId()); 57 QVERIFY(a.getId().untyped != x.getUntypedId());
57 58
58 A aa; 59 A aa;
59 QVERIFY(aa.getId().untyped != a.getId().untyped); 60 QVERIFY(aa.getId().untyped != a.getId().untyped);
182 void duplicateAdd() { 183 void duplicateAdd() {
183 auto a = std::make_shared<A>(); 184 auto a = std::make_shared<A>();
184 AById::add(a); 185 AById::add(a);
185 try { 186 try {
186 AById::add(a); 187 AById::add(a);
187 cerr << "Failed to catch expected exception in duplicateAdd" << endl; 188 std::cerr << "Failed to catch expected exception in duplicateAdd"
189 << std::endl;
188 QVERIFY(false); 190 QVERIFY(false);
189 } catch (const std::logic_error &) { 191 } catch (const std::logic_error &) {
190 } 192 }
191 AById::release(a); 193 AById::release(a);
192 } 194 }
195 auto a = std::make_shared<A>(); 197 auto a = std::make_shared<A>();
196 auto b1 = std::make_shared<B1>(); 198 auto b1 = std::make_shared<B1>();
197 AById::add(a); 199 AById::add(a);
198 try { 200 try {
199 AById::release(b1); 201 AById::release(b1);
200 cerr << "Failed to catch expected exception in unknownRelease" << endl; 202 std::cerr << "Failed to catch expected exception in unknownRelease"
203 << std::endl;
201 QVERIFY(false); 204 QVERIFY(false);
202 } catch (const std::logic_error &) { 205 } catch (const std::logic_error &) {
203 } 206 }
204 AById::release(a); 207 AById::release(a);
205 } 208 }