/home5/piconepr/public_html/isip/projects/speech/software/documentation/class/search/Hypothesis/hyp_02.cc
// file: $isip/class/search/Hypothesis/hyp_02.cc
// version: $Id: hyp_02.cc 8862 2002-12-05 21:03:20Z alphonso $
//
// isip include files
//
#include "Hypothesis.h"
#include <Console.h>
[snipped]
// method: diagnose
//
// arguments:
// Integral::DEBUG level: (input) debug level for diagnostics
//
// return: logical error status
//
// this is the diagnostics method
//
boolean Hypothesis::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();
}
// 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();
}
// declare variables
//
Trace* trace_00 = new Trace();
Hypothesis hyp_00(trace_00, -1.76);
if (hyp_00.getTrace() != trace_00) {
return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__);
}
if (Integral::almostEqual((double)hyp_00.getScore(), (double)1.76)) {
return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__);
}
// test the assign methods
//
Hypothesis hyp_01(hyp_00);
if (!hyp_01.eq(hyp_00)) {
return Error::handle(name(), L"diagnose", Error::TEST, __FILE__, __LINE__);
}
// clean up
//
delete trace_00;
// 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;
}
[snipped]
//
// end of file
Up |
Home |
Courses |
Projects |
Proposals |
Publications
Please direct questions or comments to
joseph.picone@isip.piconepress.com