📄 tnod_02.cc
字号:
// file: $isip/class/search/TrainNode/tnod_02.cc// version: $Id: tnod_02.cc,v 1.5 2003/01/01 23:35:59 alphonso Exp $//// isip include files//#include "TrainNode.h"// method: diagnose//// arguments:// Integral::DEBUG level: (input) debug level for diagnostics//// return: logical error status//// this is the diagnostics method//boolean TrainNode::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 // TrainNode tnode_00; tnode_00.setAlpha(-13.465); if (!Integral::almostEqual((double)-13.465, tnode_00.getAlpha())) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setBeta(-1.695); if (!Integral::almostEqual((double)-1.695, tnode_00.getBeta())) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setScore(-23.489); if (!Integral::almostEqual((double)-23.489, tnode_00.getScore())) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setFrame(23); if (tnode_00.getFrame() != 23) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } StatisticalModel* model = new StatisticalModel(); if (tnode_00.getValidModel()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setStatisticalModel(model); if (tnode_00.getStatisticalModel() != model) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (!tnode_00.getValidModel()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setValidNode(true); if (!tnode_00.getValidNode()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setValidNode(false); if (tnode_00.getValidNode()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setAlphaValid(true); if (!tnode_00.isAlphaValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setAlphaValid(false); if (tnode_00.isAlphaValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setAccumulatorValid(true); if (!tnode_00.isAccumulatorValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setAccumulatorValid(false); if (tnode_00.isAccumulatorValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setBetaValid(true); if (!tnode_00.isBetaValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } tnode_00.setBetaValid(false); if (tnode_00.isBetaValid()) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } // free allocated memory // delete model; // 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;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -