123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifdef NICE_USELIB_CPPUNIT
- #include "TestGenericClusterAlgorithmSelectionPersistent.h"
- using namespace std;
- using namespace NICE;
- const bool verboseStartEnd = true;
- const bool verbose = true;
- CPPUNIT_TEST_SUITE_REGISTRATION( TestGenericClusterAlgoSelectionPersistent );
- void TestGenericClusterAlgoSelectionPersistent::setUp() {
- }
- void TestGenericClusterAlgoSelectionPersistent::tearDown() {
- }
- void TestGenericClusterAlgoSelectionPersistent::testPersistentMethods()
- {
-
- if (verboseStartEnd)
- std::cerr << "================== TestGenericClusterAlgoSelectionPersistent::testPersistentMethods ===================== " << std::endl;
-
- NICE::Config conf;
- conf.sS( "GenericClusterAlgoSelection", "clusterTechnique", "KMeans" );
- OBJREC::ClusterAlgorithm * cluster;
-
- cluster = OBJREC::GenericClusterAlgorithmSelection::selectClusterAlgorithm ( &conf, "GenericClusterAlgoSelection");
-
-
- if ( verbose )
- std::cerr << " TEST STORING ABILITIES FOR STANDARD LOCALFEATURE" << std::endl;
-
- std::string s_destination_save ( "myClusterAlgoSelection.txt" );
-
- std::filebuf fbOut;
- fbOut.open ( s_destination_save.c_str(), ios::out );
- std::ostream os (&fbOut);
-
- cluster->store( os );
-
- fbOut.close();
-
-
- if ( verbose )
- std::cerr << " TEST RESTORING ABILITIES FOR STANDARD LOCALFEATURE" << std::endl;
-
- OBJREC::ClusterAlgorithm * clusterRestore = NULL;
-
- std::string s_destination_load ( "myClusterAlgoSelection.txt" );
-
- std::filebuf fbIn;
- fbIn.open ( s_destination_load.c_str(), ios::in );
- std::istream is (&fbIn);
-
- OBJREC::GenericClusterAlgorithmSelection::restoreClusterAlgorithm ( clusterRestore, is );
-
- fbIn.close();
-
-
-
-
-
- if ( cluster != NULL )
- delete cluster;
-
- if ( clusterRestore != NULL )
- delete clusterRestore;
-
- if (verboseStartEnd)
- std::cerr << "================== TestGenericClusterAlgoSelectionPersistent::testPersistentMethods done ===================== " << std::endl;
-
- }
- #endif
|