694{
695 unsigned int nb = 0;
696 unsigned int nbok = 0;
697 DummyTbl a1( 50, 10 );
700 DummyTbl::reset();
702
703
704 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to DummyTbl member. Duplication (+1/0)" );
705 CloneToValueMember c00( a1 );
706 trace.
info() <<
"D: d1.value() = " << c00.value() << std::endl;
707 ++nb; nbok += DummyTbl::nbCreated==1 ? 1 : 0;
708 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
709 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
710 << " nbCreated=" << DummyTbl::nbCreated
711 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
713
714 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl>) to DummyTbl member. Duplication (+1/0)" );
715 CloneToValueMember c30( a1 );
716 trace.
info() <<
"D: d1.value() = " << c30.value() << std::endl;
717 ++nb; nbok += DummyTbl::nbCreated==2 ? 1 : 0;
718 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
719 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
720 << " nbCreated=" << DummyTbl::nbCreated
721 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
723
724 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to CountedPtr<DummyTbl> member. Duplication (+1/0)" );
725 CloneToCountedMember c03( a1 );
726 trace.
info() <<
"D: d1.value() = " << c03.value() << std::endl;
727 ++nb; nbok += DummyTbl::nbCreated==3 ? 1 : 0;
728 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
729 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
730 << " nbCreated=" << DummyTbl::nbCreated
731 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
733
734 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to CowPtr<DummyTbl> member. Duplication (+1/0)" );
735 CloneToCowMember c02( a1 );
736 trace.
info() <<
"D: d1.value() = " << c02.value() << std::endl;
737 ++nb; nbok += DummyTbl::nbCreated==4 ? 1 : 0;
738 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
739 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
740 << " nbCreated=" << DummyTbl::nbCreated
741 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
743
744 trace.
beginBlock (
"Clone: #DummyTbl with (CowPtr<DummyTbl> &) to CowPtr<DummyTbl> member. Lazy duplication (0/0)" );
745 CloneToCowMember c22( cow_a1 );
746 trace.
info() <<
"D: d1.value() = " << c22.value() << std::endl;
747 ++nb; nbok += DummyTbl::nbCreated==4 ? 1 : 0;
748 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
749 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
750 << " nbCreated=" << DummyTbl::nbCreated
751 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
752 c22.setValue( 17 );
753 trace.
info() <<
"D: d1.setValue( 17 ) -> now duplicating " << std::endl;
754 trace.
info() <<
"D: d1.value() = " << c22.value() << std::endl;
755 ++nb; nbok += DummyTbl::nbCreated==5 ? 1 : 0;
756 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
757 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
758 << " nbCreated=" << DummyTbl::nbCreated
759 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
761
762 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl> &) to CowPtr<DummyTbl> member. Lazy duplication (0/0)" );
763 CloneToCowMember c32( counted_a1 );
764 trace.
info() <<
"D: d1.value() = " << c32.value() << std::endl;
765 ++nb; nbok += DummyTbl::nbCreated==5 ? 1 : 0;
766 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
767 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
768 << " nbCreated=" << DummyTbl::nbCreated
769 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
770 c32.setValue( 21 );
771 trace.
info() <<
"D: d1.setValue( 21 ) -> now duplicating " << std::endl;
772 trace.
info() <<
"D: d1.value() = " << c32.value() << std::endl;
773 ++nb; nbok += DummyTbl::nbCreated==6 ? 1 : 0;
774 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
775 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
776 << " nbCreated=" << DummyTbl::nbCreated
777 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
779
780 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to DummyTbl member. Acquisition, duplication, delete (+2/+1)" );
781 CloneToValueMember c10( new DummyTbl( 50, 2 ) );
782 trace.
info() <<
"D: d1.value() = " << c10.value() << std::endl;
783 ++nb; nbok += DummyTbl::nbCreated==8 ? 1 : 0;
784 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
785 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
786 << " nbCreated=" << DummyTbl::nbCreated
787 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
789
790 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to CowPtr<DummyTbl> member. Acquisition, no duplication (+1/0)" );
791 CloneToCowMember c12( new DummyTbl( 50, 15 ) );
792 trace.
info() <<
"D: d1.value() = " << c12.value() << std::endl;
793 ++nb; nbok += DummyTbl::nbCreated==9 ? 1 : 0;
794 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
795 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
796 << " nbCreated=" << DummyTbl::nbCreated
797 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
799
800 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl&) to DummyTbl* member. Duplication (+1/0)" );
801 CloneToPtrMember c01( a1 );
802 trace.
info() <<
"D: d1.value() = " << c01.value() << std::endl;
803 ++nb; nbok += DummyTbl::nbCreated==10 ? 1 : 0;
804 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
805 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
806 << " nbCreated=" << DummyTbl::nbCreated
807 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
809
810 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to DummyTbl* member. Acquisition (+1/0)" );
811 CloneToPtrMember c11( new DummyTbl( 50, 42 ) );
812 trace.
info() <<
"D: d1.value() = " << c11.value() << std::endl;
813 ++nb; nbok += DummyTbl::nbCreated==11 ? 1 : 0;
814 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
815 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
816 << " nbCreated=" << DummyTbl::nbCreated
817 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
819
820 trace.
beginBlock (
"Clone: #DummyTbl with (CowPtr<DummyTbl>) to DummyTbl* member. Duplication (+1/0)" );
821 CloneToPtrMember c21( cow_a1 );
822 trace.
info() <<
"D: d1.value() = " << c21.value() << std::endl;
823 ++nb; nbok += DummyTbl::nbCreated==12 ? 1 : 0;
824 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
825 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
826 << " nbCreated=" << DummyTbl::nbCreated
827 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
829
830 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl>) to DummyTbl* member. Duplication (+1/0)" );
831 CloneToPtrMember c31( counted_a1 );
832 trace.
info() <<
"D: d1.value() = " << c31.value() << std::endl;
833 ++nb; nbok += DummyTbl::nbCreated==13 ? 1 : 0;
834 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
835 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
836 << " nbCreated=" << DummyTbl::nbCreated
837 << " nbDeleted=" << DummyTbl::nbDeleted << std::endl;
839
840 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to DummyTbl member. Duplication by move (+2/+1/+1)" );
841 CloneToValueMember c40( DummyTbl( 50, -4 ) );
842 trace.
info() <<
"D: d1.value() = " << c40.value() << std::endl;
843 ++nb; nbok += DummyTbl::nbCreated==15 ? 1 : 0;
844 ++nb; nbok += DummyTbl::nbDeleted==2 ? 1 : 0;
845 ++nb; nbok += DummyTbl::nbMoved==1 ? 1 : 0;
846 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
847 << " nbCreated=" << DummyTbl::nbCreated
848 << " nbDeleted=" << DummyTbl::nbDeleted
849 << " nbMoved=" << DummyTbl::nbMoved
850 << std::endl;
852
853 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to CowPtr<DummyTbl> member. Duplication by move (+2/+1/+1)" );
854 CloneToCowMember c42( DummyTbl( 50, -9 ) );
855 trace.
info() <<
"D: d1.value() = " << c42.value() << std::endl;
856 ++nb; nbok += DummyTbl::nbCreated==17 ? 1 : 0;
857 ++nb; nbok += DummyTbl::nbDeleted==3 ? 1 : 0;
858 ++nb; nbok += DummyTbl::nbMoved==2 ? 1 : 0;
859 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
860 << " nbCreated=" << DummyTbl::nbCreated
861 << " nbDeleted=" << DummyTbl::nbDeleted
862 << " nbMoved=" << DummyTbl::nbMoved
863 << std::endl;
865
866 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to DummyTbl* member. Duplication by move (+2/+1/+1)" );
867 CloneToCowMember c41( DummyTbl( 50, -12 ) );
868 trace.
info() <<
"D: d1.value() = " << c41.value() << std::endl;
869 ++nb; nbok += DummyTbl::nbCreated==19 ? 1 : 0;
870 ++nb; nbok += DummyTbl::nbDeleted==4 ? 1 : 0;
871 ++nb; nbok += DummyTbl::nbMoved==3 ? 1 : 0;
872 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
873 << " nbCreated=" << DummyTbl::nbCreated
874 << " nbDeleted=" << DummyTbl::nbDeleted
875 << " nbMoved=" << DummyTbl::nbMoved
876 << std::endl;
878
880
881 return nbok == nb;
882}