MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / testAssignment

Method testAssignment

test/tests/containers/TestMap.h:370–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368 }
369
370 void testAssignment() {
371
372 Map<int, int> map1(mAllocator);
373 map1.add(Pair<int, int>(1, 3));
374 map1.add(Pair<int, int>(2, 6));
375 map1.add(Pair<int, int>(10, 30));
376
377 Map<int, int> map2(mAllocator);
378 map2 = map1;
379 rp3d_test(map2.size() == map1.size());
380 rp3d_test(map1 == map2);
381 rp3d_test(map2[1] == 3);
382 rp3d_test(map2[2] == 6);
383 rp3d_test(map2[10] == 30);
384
385 Map<int, int> map3(mAllocator, 100);
386 map3 = map1;
387 rp3d_test(map3.size() == map1.size());
388 rp3d_test(map3 == map1);
389 rp3d_test(map3[1] == 3);
390 rp3d_test(map3[2] == 6);
391 rp3d_test(map3[10] == 30);
392
393 Map<int, int> map4(mAllocator);
394 map3 = map4;
395 rp3d_test(map3.size() == 0);
396 rp3d_test(map3 == map4);
397
398 Map<int, int> map5(mAllocator);
399 map5.add(Pair<int, int>(7, 8));
400 map5.add(Pair<int, int>(19, 70));
401 map1 = map5;
402 rp3d_test(map5.size() == map1.size());
403 rp3d_test(map5 == map1);
404 rp3d_test(map1[7] == 8);
405 rp3d_test(map1[19] == 70);
406 }
407
408 void testIterators() {
409

Callers

nothing calls this directly

Calls 2

addMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected