📄 cpol_02.cc
字号:
// file: $isip/class/search/ContextPool/cpol_02.cc// version: $Id: cpol_02.cc,v 1.2 2003/01/23 20:00:25 alphonso Exp $//// isip include files//#include "ContextPool.h"// method: diagnose//// arguments:// Integral::DEBUG level: (input) debug level for diagnostics//// return: logical error status//// this is the diagnostics method//boolean ContextPool::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(); } Context* cont_00 = (Context*)NULL; Context* cont_01 = (Context*)NULL; Context* cont_02 = (Context*)NULL; ContextPool cpol_00; ContextPool cpol_01; if (!cpol_00.eq(cpol_01)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } cont_00 = cpol_00.initAndAllocate(); cont_01 = cpol_00.initAndAllocate(); if (cpol_00.eq(cpol_01)) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_00 != cont_01) { 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(); } Context* cont_03 = (Context*)NULL; Context* cont_04 = (Context*)NULL; Context* cont_05 = (Context*)NULL; Context* cont_06 = (Context*)NULL; Context* cont_07 = (Context*)NULL; GraphVertex<SearchNode> tmp_vertex; Context tmp_context(3, 1); cont_03 = cpol_00.get(tmp_context); if (cont_03 == cont_00) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_03 == cont_01) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } cont_04 = cpol_00.shiftAndAllocate(cont_03, &tmp_vertex); if (cont_04 == cont_00) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_04 == cont_01) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_04 == cont_02) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_04 == cont_03) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } cont_05 = cpol_00.shiftAndAllocate(cont_04, &tmp_vertex); if (cont_05 == cont_00) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_05 == cont_01) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_05 == cont_02) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_05 == cont_03) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_05 == cont_04) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } cont_06 = cpol_00.shiftAndAllocate(cont_05, &tmp_vertex); if (cont_06 == cont_00) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_06 == cont_01) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_06 == cont_02) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_06 == cont_03) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_06 == cont_04) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_06 == cont_05) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } cont_07 = cpol_00.shiftAndAllocate(cont_06, &tmp_vertex); if (cont_07 == cont_00) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 == cont_01) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 == cont_02) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 == cont_03) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 == cont_04) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 == cont_05) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (cont_07 != cont_06) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } Context test_00(3, 1); Context* ptr1 = (Context*)NULL; Context* ptr2 = (Context*)NULL; test_00.assignAndAdvance(200000); test_00.assignAndAdvance(300000); test_00.assignAndAdvance(400000); if ((ptr1 = cpol_00.get(test_00)) == (Context*)NULL) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if ((ptr2 = cpol_00.get(test_00)) == (Context*)NULL) { return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__); } if (ptr1 != ptr2) { return Error::handle(name(), L"diagnose", 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;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -