// file: $isip/class/search/SearchLevel/slev_02.cc // version: $Id: slev_02.cc 9458 2004-04-19 15:08:38Z gao $ // // isip include files // #include "SearchLevel.h" #ifndef ISIP_CONSOLE #include #endif // method: diagnose // // arguments: // Integral::DEBUG level: (input) debug level for diagnostics // // return: logical error status // // this is the diagnostics method // bool8 SearchLevel::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 // String tag(L"word"); SearchLevel slev_00; slev_00.setLevelTag(tag); if (!slev_00.getLevelTag().eq(tag)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setLmScale(0.86); if (!Integral::almostEqual((float64)slev_00.getLmScale(), (float64)0.86)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setTrScale(0.48); if (!Integral::almostEqual((float64)slev_00.getTrScale(), (float64)0.48)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setSymbolPenalty(-1.967); if (!Integral::almostEqual((float64)slev_00.getSymbolPenalty(), (float64)-1.967)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setNumSubGraphs(27); if (slev_00.getNumSubGraphs() != 27) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setLevelIndex(2); if (slev_00.getLevelIndex() != 2) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setBeam(true, 104.78); if (!Integral::almostEqual((float64)slev_00.getBeamThreshold(), (float64)104.78)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } slev_00.setInstance(true, 128); if (slev_00.getInstanceThreshold() != 128) { 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; }