// file: $isip/class/asr/JSGFToken/jt_02.cc // version: $Id: jt_02.cc 7680 2002-02-01 17:06:39Z huang $ // // isip include files // #include "JSGFToken.h" #include // method: diagnose // // arguments: // Integral::DEBUG level: (input) debug level for diagnostics // // return: a bool8 value indicating status // bool8 JSGFToken::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(); } // test instantiation // JSGFToken jt; Console::put(L"instantiation passed\n"); // 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(); } // test setToken method // String token_str(L"public"); if(!jt.setToken(token_str)) { return Error::handle(name(), L"setToken", Error::TEST, __FILE__, __LINE__); } // test printToken method // if(!jt.printToken()) { return Error::handle(name(), L"printToken", Error::TEST, __FILE__, __LINE__); } // test setCoordinate method // int32 row = 3; int32 col = 4; if(!jt.setCoordinate(row, col)) { return Error::handle(name(), L"setCoordinate", Error::TEST, __FILE__, __LINE__); } // 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; }