@@ -567,212 +567,6 @@ print_type (const OPENEXR_IMF_NAMESPACE::TypedAttribute<T>& object)
567
567
cout << object.typeName () << endl;
568
568
}
569
569
570
- OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
571
-
572
- //
573
- // Test to confirm that the copy/move constructors are implemented
574
- // properly.
575
- //
576
-
577
- static int default_constructor;
578
- static int destructor;
579
- static int copy_constructor;
580
- static int assignment_operator;
581
- static int move_constructor;
582
- static int move_assignment_operator;
583
-
584
- struct TestType
585
- {
586
- TestType () : _f (0 ) { default_constructor++; }
587
-
588
- ~TestType () { destructor++; }
589
-
590
- TestType (const TestType& other) : _f (other._f) { copy_constructor++; }
591
-
592
- TestType& operator = (const TestType& other)
593
- {
594
- assignment_operator++;
595
- _f = other._f ;
596
- return *this ;
597
- }
598
-
599
- TestType (TestType&& other) : _f (std::move (other._f))
600
- {
601
- move_constructor++;
602
- }
603
-
604
- TestType& operator = (TestType&& other)
605
- {
606
- move_assignment_operator++;
607
- _f = std::move (other._f );
608
- return *this ;
609
- }
610
-
611
- static TestType func ()
612
- {
613
- TestType t;
614
- return t;
615
- }
616
-
617
- static TestType arg (TestType a) { return a; }
618
-
619
- int _f;
620
-
621
- static void assert_count (int dc, int d, int cc, int ao, int mc, int mao)
622
- {
623
- assert (dc == default_constructor);
624
- assert (d == destructor);
625
- assert (cc == copy_constructor);
626
- assert (ao == assignment_operator);
627
- assert (mc == move_constructor);
628
- assert (mao == move_assignment_operator);
629
- }
630
-
631
- static void reset ()
632
- {
633
- default_constructor = 0 ;
634
- destructor = 0 ;
635
- copy_constructor = 0 ;
636
- assignment_operator = 0 ;
637
- move_constructor = 0 ;
638
- move_assignment_operator = 0 ;
639
- }
640
-
641
- static std::string str ()
642
- {
643
- std::stringstream s;
644
- if (default_constructor)
645
- s << " default_constructor=" << default_constructor << std::endl;
646
- if (destructor) s << " destructor=" << destructor << std::endl;
647
-
648
- if (copy_constructor)
649
- s << " copy_constructor=" << copy_constructor << std::endl;
650
-
651
- if (assignment_operator)
652
- s << " assignment_operator=" << assignment_operator << std::endl;
653
- if (move_constructor)
654
- s << " move_constructor=" << move_constructor << std::endl;
655
-
656
- if (move_assignment_operator)
657
- s << " move_assignment_operator=" << move_assignment_operator
658
- << std::endl;
659
- return s.str ();
660
- }
661
- };
662
-
663
- typedef TypedAttribute<TestType> TestTypedAttribute;
664
-
665
- template <>
666
- const char *
667
- TestTypedAttribute::staticTypeName ()
668
- {
669
- return " test" ;
670
- }
671
-
672
- template <>
673
- void
674
- TestTypedAttribute::writeValueTo (
675
- OPENEXR_IMF_INTERNAL_NAMESPACE::OStream& os, int version) const
676
- {}
677
-
678
- template <>
679
- void
680
- TestTypedAttribute::readValueFrom (
681
- OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, int size, int version)
682
- {}
683
-
684
- TestType
685
- testTypeFunc ()
686
- {
687
- return TestType ();
688
- }
689
-
690
- TestTypedAttribute
691
- testFunc ()
692
- {
693
- TestTypedAttribute a;
694
- return a;
695
- }
696
-
697
- TestTypedAttribute
698
- testArg (TestTypedAttribute a)
699
- {
700
- return a;
701
- }
702
-
703
- OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
704
-
705
- void
706
- testTypedAttribute ()
707
- {
708
- std::cout << " running testTypedAttribute()\n " ;
709
-
710
- using namespace OPENEXR_IMF_INTERNAL_NAMESPACE ;
711
-
712
- //
713
- // Validate the test type
714
- //
715
-
716
- TestType A;
717
- TestType::assert_count (1 , 0 , 0 , 0 , 0 , 0 );
718
- TestType::reset ();
719
-
720
- TestType B (A);
721
- TestType::assert_count (0 , 0 , 1 , 0 , 0 , 0 );
722
- TestType::reset ();
723
-
724
- B = A;
725
- TestType::assert_count (0 , 0 , 0 , 1 , 0 , 0 );
726
- TestType::reset ();
727
-
728
- A = std::move (B);
729
- TestType::assert_count (0 , 0 , 0 , 0 , 0 , 1 );
730
- TestType::reset ();
731
-
732
- A = TestType::func ();
733
- TestType::assert_count (1 , 1 , 0 , 0 , 0 , 1 );
734
- TestType::reset ();
735
-
736
- A = TestType::arg (B);
737
- TestType::assert_count (0 , 2 , 1 , 0 , 1 , 1 );
738
- TestType::reset ();
739
-
740
- //
741
- // Test the attribute type
742
- //
743
-
744
- TestTypedAttribute a;
745
- TestType::assert_count (1 , 0 , 0 , 0 , 0 , 0 );
746
- TestType::reset ();
747
-
748
- {
749
- TestType x;
750
- }
751
- TestType::assert_count (1 , 1 , 0 , 0 , 0 , 0 );
752
- TestType::reset ();
753
-
754
- TestTypedAttribute b (a);
755
- TestType::assert_count (0 , 0 , 1 , 0 , 0 , 0 );
756
- TestType::reset ();
757
-
758
- a = b;
759
- TestType::assert_count (0 , 0 , 0 , 1 , 0 , 0 );
760
- TestType::reset ();
761
-
762
- a = std::move (b);
763
- TestType::assert_count (0 , 0 , 0 , 0 , 0 , 1 );
764
- TestType::reset ();
765
-
766
- a = testFunc ();
767
- TestType::assert_count (1 , 1 , 0 , 0 , 0 , 1 );
768
- TestType::reset ();
769
-
770
- a = testArg (b);
771
- TestType::assert_count (0 , 2 , 1 , 0 , 1 , 1 );
772
- TestType::reset ();
773
-
774
- std::cout << " ok." << std::endl;
775
- }
776
570
777
571
void
778
572
testAttributes (const std::string& tempDir)
@@ -781,8 +575,6 @@ testAttributes (const std::string& tempDir)
781
575
{
782
576
cout << " Testing built-in attributes" << endl;
783
577
784
- testTypedAttribute ();
785
-
786
578
const int W = 217 ;
787
579
const int H = 197 ;
788
580
0 commit comments