00001 00002 // 00003 // RecValidate 00004 // 00005 // Package: (Rec) Record 00006 // 00007 // S. Kasahara 08/2002 00008 // 00009 // Purpose: Class for use in validating the Record package. 00010 // 00012 00013 #include <iostream> 00014 using std::cout; 00015 using std::cerr; 00016 using std::endl; 00017 #include "MinosObjectMap/test/MomValidate.h" 00018 #include "MinosObjectMap/MomNavigator.h" 00019 #include "Record/RecMinos.h" 00020 #include "Record/RecRecordImp.h" 00021 #include "Record/RecHeader.h" 00022 00023 // Definition of static data members 00024 // ********************************* 00025 00026 // Definition of methods (alphabetical order) 00027 // *************************************************** 00028 00029 MomValidate::MomValidate() { 00030 // 00031 // Purpose: Default constructor. 00032 // 00033 // Arguments: none. 00034 // 00035 // Return: n/a. 00036 00037 } 00038 00039 MomValidate::~MomValidate() { 00040 // 00041 // Purpose: Destructor. 00042 // 00043 00044 } 00045 00046 bool MomValidate::TestMomNavigatorClear() { 00047 // 00048 // Purpose: Test MomNavigator::Clear() method 00049 // 00050 // Contact: S. Kasahara 00051 // 00052 00053 MomNavigator mom; 00054 RecMinos* record = new RecMinos(); 00055 mom.AdoptFragment(record); 00056 RecMinos* record2 = new RecMinos(); 00057 mom.AdoptFragment(record2); 00058 RecRecordImp<RecHeader>* record3 = new RecRecordImp<RecHeader>(); 00059 mom.AdoptFragment(record3); 00060 RecRecordImp<RecHeader>* record4 = new RecRecordImp<RecHeader>(); 00061 mom.AdoptFragment(record4); 00062 cout << "After fill of 4 transient records, mom has:" << endl; 00063 mom.GetFragmentArray()->Print(); 00064 mom.Clear(); 00065 cout << "Post clear:" << endl; 00066 mom.GetFragmentArray()->Print(); 00067 00068 record = new RecMinos(); 00069 mom.AdoptFragment(record); 00070 record2 = new RecMinos(); record2 -> SetTransient(false); 00071 mom.AdoptFragment(record2); 00072 record3 = new RecRecordImp<RecHeader>(); 00073 mom.AdoptFragment(record3); 00074 record4 = new RecRecordImp<RecHeader>(); record4 -> SetTransient(false); 00075 mom.AdoptFragment(record4); 00076 cout << "After fill of 4 records, 2nd & 4th are permanent:" << endl; 00077 mom.GetFragmentArray()->Print(); 00078 mom.Clear(); 00079 cout << "Post clear:" << endl; 00080 mom.GetFragmentArray()->Print(); 00081 00082 return true; 00083 00084 } 00085 00086 bool MomValidate::RunAllTests() { 00087 // 00088 // Purpose: Run sequence of MinosObjectMap package validity tests. 00089 // 00090 // Arguments: none. 00091 // 00092 // Return: pass (if all tests successful) or fail 00093 // 00094 00095 bool allPassed = true; 00096 00097 cout << "*** TestMomNavigatorClear *** " << endl; 00098 if ( this -> TestMomNavigatorClear() ) cout << "*** Passed ***" << endl; 00099 else { 00100 cout << "*** Failed ***" << endl; 00101 allPassed = false; 00102 } 00103 00104 return allPassed; 00105 00106 }
1.3.9.1