// file: $isip/class/search/SearchNode/snod_02.cc // version: $Id: snod_02.cc 8868 2002-12-05 22:18:11Z alphonso $ // // isip include files // #include "SearchNode.h" #include #include // method: diagnose // // arguments: // Integral::DEBUG level: (input) debug level for diagnostics // // return: logical error status // // this is the diagnostics method // bool8 SearchNode::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 // SearchNode snode_00; StatisticalModel* model = new StatisticalModel(); snode_00.setStatisticalModel(model); if (snode_00.getStatisticalModel() != model) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } snode_00.setScore(-12.569); if (!Integral::almostEqual((float64)snode_00.getScore(), -12.569)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } // clean up // delete model; SearchLevel* level = new SearchLevel(); snode_00.setSearchLevel(level); if (snode_00.getSearchLevel() != level) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } // clean up // delete level; LexicalTree* lextree = new LexicalTree(); snode_00.setLexicalTree(lextree); if (snode_00.getLexicalTree() != lextree) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } // clean up // delete lextree; // 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; }