MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / Object_Copy_Count_Test

Class Object_Copy_Count_Test

unittests/compiled_tests.cpp:608–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606////// Object copy count test
607
608class Object_Copy_Count_Test
609{
610 public:
611 Object_Copy_Count_Test()
612 {
613 std::cout << "Object_Copy_Count_Test()\n";
614 ++constructcount();
615 }
616
617 Object_Copy_Count_Test(const Object_Copy_Count_Test &)
618 {
619 std::cout << "Object_Copy_Count_Test(const Object_Copy_Count_Test &)\n";
620 ++copycount();
621 }
622
623 Object_Copy_Count_Test(Object_Copy_Count_Test &&)
624 {
625 std::cout << "Object_Copy_Count_Test(Object_Copy_Count_Test &&)\n";
626 ++movecount();
627 }
628
629 ~Object_Copy_Count_Test()
630 {
631 std::cout << "~Object_Copy_Count_Test()\n";
632 ++destructcount();
633 }
634
635 static int& constructcount()
636 {
637 static int c = 0;
638 return c;
639 }
640
641 static int& copycount()
642 {
643 static int c = 0;
644 return c;
645 }
646
647 static int& movecount()
648 {
649 static int c = 0;
650 return c;
651 }
652
653 static int& destructcount()
654 {
655 static int c = 0;
656 return c;
657 }
658};
659
660Object_Copy_Count_Test object_copy_count_create()
661{

Callers 1

object_copy_count_createFunction · 0.85

Calls

no outgoing calls

Tested by 1

object_copy_count_createFunction · 0.68