⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itgl_02.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
📖 第 1 页 / 共 2 页
字号:
// file: $isip/class/system/Integral/itgl_02.cc// version: $Id: itgl_02.cc,v 1.17 2001/07/24 00:44:30 picone Exp $//// isip include files//#include "Integral.h"#include <Console.h>#include <SysString.h>//#include <Error.h>// method: diagnose//// arguments://  DEBUG level: (input) debug level for diagnostics//// return: a boolean value indicating status//boolean Integral::diagnose(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 the debug methods  //  setDebug(debug_level_d);    if (level_a > Integral::BRIEF) {    Integral::debug(L"debug");  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //--------------------------------------------------------------------------  //  // 2. class-specific public methods:  //     general operating system methods  //  //--------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: general operating system methods...\n");    Console::increaseIndention();  }    // test getEnv  //  SysString var(L"HOME");  SysString val;  boolean ret;    ret = Integral::getEnv(val, var);     if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"getEnv", Error::TEST, __FILE__, __LINE__);  }    // test getLoginDir  //  var.assign(L"root");  ret = Integral::getLoginDir(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"getLoginDir", Error::TEST, __FILE__, __LINE__);  }    // test expandName  //  var.assign(L"$isip/include/integral.h");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"/tmp/\\$isip/include/integral.h");  ret = Integral::expandName(val, var);  if ((!ret) || (!val.eq(L"/tmp/$isip/include/integral.h"))) {    var.debug(L"var");    val.debug(L"val");    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~/login/editor_emacs_bindings.el");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~/login/$ISIP_BINARY/editor_emacs_bindings.el");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~root/$NO_VARIABLE_EXISTS/editor_emacs_bindings.el");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~root");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret) || (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    var.assign(L"~/");  ret = Integral::expandName(val, var);  if (level_a > Integral::DETAILED) {    var.debug(L"var");    val.debug(L"val");    Console::put(L"\n");  }  if ((!ret)|| (val.length() == 0)) {    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }  var.assign(L"/tmp/tmp_\\$\\$\\$");  ret = Integral::expandName(val, var);  if ((!ret) || (val.ne(L"/tmp/tmp_$$$"))) {    var.debug(L"var");    val.debug(L"val");    Error::handle(name(), L"expandName", Error::TEST, __FILE__, __LINE__);  }    // test getPid and getParentPid  //  long pid = getPid();  long ppid = getParentPid();  if (level_a > Integral::DETAILED) {    val.assign(pid);    var.debugStr(name(), L"diagnose", L"pid", val);    Console::put(var);  }  if (level_a > Integral::DETAILED) {    val.assign(ppid);    var.debugStr(name(), L"diagnose", L"ppid", val);    Console::put(var);  }    // test exit(): we can't really test exit() in this method  // test maketemp  //  makeTemp(val);  if (level_a > Integral::DETAILED) {    val.debug(L"makeTemp");  }  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //--------------------------------------------------------------------------  //  // 3. class-specific public methods:  //     bit-level methods  //  //--------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: bit-level methods...\n");    Console::increaseIndention();  }    // test almostEqual  //  if (!almostEqual(3.0001, 3.0000)) {    return Error::handle(name(), L"almostEqual", Error::TEST,			 __FILE__, __LINE__);  }  if (!almostEqual(3.1, 3.0, 10.0)) {    return Error::handle(name(), L"almostEqual", Error::TEST,			 __FILE__, __LINE__);  }  if (!almostEqual(3.0, 3.1, 10.0)) {    return Error::handle(name(), L"almostEqual", Error::TEST,			 __FILE__, __LINE__);  }  if (almostEqual((long)300001, (long)300002)) {    return Error::handle(name(), L"almostEqual", Error::TEST,			 __FILE__, __LINE__);  }  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //--------------------------------------------------------------------------  //  // 4. class-specific public methods:  //     inlined wrappers for math and other C functions  //  //--------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: inline wrappers...\n");    Console::increaseIndention();  }    if (!almostEqual(abs(-27.0), (double)27.0)) {    return Error::handle(name(), L"abs", Error::TEST, __FILE__, __LINE__);  }  if (!almostEqual(acos(0.0), M_PI_2)) {    return Error::handle(name(), L"acos", Error::TEST, __FILE__, __LINE__);  }  if (!almostEqual(asin(1.0), M_PI_2)) {    return Error::handle(name(), L"asin", Error::TEST, __FILE__, __LINE__);  }  if (!almostEqual(asinh(2.3013), M_PI_2)) {    return Error::handle(name(), L"asinh", Error::TEST, __FILE__, __LINE__);  }  if (!almostEqual(atan(1.0), M_PI_4)) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -