// file: $isip/class/search/Instance/inst_02.cc // version: $Id: inst_02.cc 9000 2003-01-23 20:00:34Z alphonso $ // // isip include files // #include "Instance.h" #include // method: diagnose // // arguments: // Integral::DEBUG level: (input) debug level for diagnostics // // return: logical error status // // this is the diagnostics method // bool8 Instance::diagnose(Integral::DEBUG level_a) { //---------------------------------------------------------------------- // // 0. preliminaries // //---------------------------------------------------------------------- // output the class name // if (level_a > Integral::NONE) { SysString output(L"diagnosing class "); output.concat(CLASS_NAME); output.concat(L": "); Console::put(output); Console::increaseIndention(); } //--------------------------------------------------------------------- // // 1. required public methods // //--------------------------------------------------------------------- // set indentation // if (level_a > Integral::NONE) { Console::put(L"testing required public methods...\n"); Console::increaseIndention(); } // declare variables // Instance inst_00; // test get/set methods // inst_00.setInstanceMode(Instance::TRAIN); if (inst_00.getInstanceMode() != Instance::TRAIN) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setInstanceMode(Instance::DECODE); if (inst_00.getInstanceMode() != Instance::DECODE) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setInstanceState(Instance::PSEUDO_ACTIVE); if (inst_00.getInstanceState() != Instance::PSEUDO_ACTIVE) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setInstanceState(Instance::ACTIVE); if (inst_00.getInstanceState() != Instance::ACTIVE) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setScore(-1.9863); if (!Integral::almostEqual((float64)inst_00.getScore(), (float64)-1.9863)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setSkipSymbol(112245); if (inst_00.getSkipSymbol() != 112245) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } inst_00.setSkipLevel(2); if (inst_00.getSkipLevel() != 2) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } //--------------------------------------------------------------------- // // 2. class-specific public methods // //--------------------------------------------------------------------- // set indentation // if (level_a > Integral::NONE) { Console::put(L"testing class-specific public methods...\n"); Console::increaseIndention(); } // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } //--------------------------------------------------------------------- // // 4. print completion message // //--------------------------------------------------------------------- // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } if (level_a > Integral::NONE) { SysString output(L"diagnostics passed for class"); output.concat(name()); output.concat(L"\n"); Console::put(output); } // exit gracefully // return true; }