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

📄 syscomplexdiagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 4 页
字号:
  c11 /= 2;  if (!Integral::almostEqual(c11 , SysComplex<double>(0, 1.65))) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }  // test operator ++ (post-increment)  //  c11 = c9;  c11 = c11++;  if (!Integral::almostEqual(c11, 5)) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }      // test operator -- (post-decrement)  //  c11 = c9;  c11 = c11--;   if (!Integral::almostEqual(c11, 5)) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }    // test operator ++ (pre-increment)  //  c11 = c9;  c11 = ++c11;   if (!Integral::almostEqual(c11, 6)) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }    // test operator -- (pre-decrement)  //  c11 = c9;  c11 = --c11;   if (!Integral::almostEqual(c11, 4)) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //---------------------------------------------------------------------------  //  // class-specific public methods:  //  relational functions with SysComplex and TIntegral types  //  //---------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put     (L"testing class-specific public methods: relational...\n");    Console::increaseIndention();  }  // test operator == (equality)  //  c11 = c10;  if (!(c11 == c10)) {   return Error::handle(name(), L"operator<",			Error::TEST, __FILE__, __LINE__);  }    // test operator !=  //  c11 = c8;  if (c11 != c8) {   return Error::handle(name(), L"operator<",			Error::TEST, __FILE__, __LINE__);  }    // test operator <  //  if (c8 < c10) {   return Error::handle(name(), L"operator<",			Error::TEST, __FILE__, __LINE__);  }    // test operator >  //  if (!(c8 > c10)) {   return Error::handle(name(), L"operator>",			Error::TEST, __FILE__, __LINE__);  }  // test operator <=  //  if (c8 <= c10) {    return Error::handle(name(), L"operator<=",			 Error::TEST, __FILE__, __LINE__);  }  // test operator >=  //  if (!(c8 >= c10)) {    return Error::handle(name(), L"operator>=",			 Error::TEST, __FILE__, __LINE__);  }    // test operator ==  //  c11 = 5;  if (!(c11 == 5)) {   return Error::handle(name(), L"operator<",			Error::TEST, __FILE__, __LINE__);  }    // test operator !=  //  c11 = 5;  if (c11 != 5) {   return Error::handle(name(), L"operator<",			Error::TEST, __FILE__, __LINE__);  }    // test operator <  //  if (r1 < c10) {    return Error::handle(name(), L"operator<",			 Error::TEST, __FILE__, __LINE__);  }    // test operator >  //  if (!(r1 > c10)) {    return Error::handle(name(), L"operator>",			 Error::TEST, __FILE__, __LINE__);  }    // test operator <=  //  if (!(c8 <= r1)) {    return Error::handle(name(), L"operator<=",			 Error::TEST, __FILE__, __LINE__);  }  // test operator >=  //  if (!(r1 >= c10)) {    return Error::handle(name(), L"operator>=",			 Error::TEST, __FILE__, __LINE__);  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }     //---------------------------------------------------------------------------  //  // class-specific public methods:  //  arithmetic functions with two complex arguments  //  //---------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put      (L"testing class-specific public methods: two complex arguments...\n");    Console::increaseIndention();  }    // test operator +  //  if (!Integral::almostEqual((c8 + c10), SysComplex<double>(4, 5.3))) {    return Error::handle(name(), L"operator +",			 Error::TEST, __FILE__, __LINE__);  }    // test operator -  //  if (!Integral::almostEqual((c8 - c10) , SysComplex<double>(4, -1.3))) {    return Error::handle(name(), L"operator -",			 Error::TEST, __FILE__, __LINE__);  }  // test operator *  //  if (!Integral::almostEqual((c8 * c10) , SysComplex<double>(-6.6, 13.2))) {    return Error::handle(name(), L"operator *",			 Error::TEST, __FILE__, __LINE__);  }  // test operator /  //  if (!Integral::almostEqual(c8 / c10, SysComplex<double>(0.6061, -1.2121))) {    return Error::handle(name(), L"operator /",			 Error::TEST, __FILE__, __LINE__);  }      // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //---------------------------------------------------------------------------  //  // class-specific public methods:  //  arithmetic functions with one complex and one real arg. since the  //  complex arg is to the left this can be a member function.  //  //---------------------------------------------------------------------------  if (level_a > Integral::NONE) {    Console::put      (L"testing class-specific public methods: complex to the left...\n");    Console::increaseIndention();    Console::increaseIndention();  }    // test operator +  //  if (!Integral::almostEqual((c8 + r1), SysComplex<double>(9, 2))) {    return Error::handle(name(), L"operator +=",			 Error::TEST, __FILE__, __LINE__);  }  // test operator -  //  if (!Integral::almostEqual((c8 - r1) , SysComplex<double>(-1, 2))) {    return Error::handle(name(), L"operator -",			 Error::TEST, __FILE__, __LINE__);  }  // test operator *  //  if (!Integral::almostEqual((c8 * r1) , SysComplex<double>(20, 10))) {    return Error::handle(name(), L"operator *",			 Error::TEST, __FILE__, __LINE__);  }  // test operator /  //  if (!Integral::almostEqual((c8 / c9), SysComplex<double>(0.8, 0.4))) {    return Error::handle(name(), L"operator /",			 Error::TEST, __FILE__, __LINE__);  }  // test inverse  //  if (!Integral::almostEqual(c8.inverse(), SysComplex<double>(0.2, -0.1))) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();    Console::decreaseIndention();  }   //---------------------------------------------------------------------------  //  // class-specific public methods:  //  miscellaneous complex methods  //  //--------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: miscellaneous...\n");    Console::increaseIndention();  }    // test conjugate  //  if (!Integral::almostEqual(c8.conjugate(), SysComplex<double>(4, -2))) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }  // test polar  //  if (!Integral::almostEqual(c8.polar(4.472, 0.436)			       , SysComplex<double>(4.05, 1.887))) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }      // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //---------------------------------------------------------------------------  //  // class-specific *public methods*:  //  arithmetic functions with one complex and one real arg. since the  //  complex arg is to the right these cannot be member functions.  //  //---------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put      (L"testing class-specific public methods: complex to the right...\n");    Console::increaseIndention();  }  // test operator +  //  if (!Integral::almostEqual(((double)r1 + c10) ,			     SysComplex<double>(5, 3.3))) {    return Error::handle(name(), L"operator +=",			 Error::TEST, __FILE__, __LINE__);  }  // test operator -  //  if (!Integral::almostEqual(((double)r1 - c10) ,			     SysComplex<double>(5, -3.3))) {    return Error::handle(name(), L"operator -",			 Error::TEST, __FILE__, __LINE__);  }   // test operator *  //  if (!Integral::almostEqual(((double)r1 * c10) ,			     SysComplex<double>(0, 16.5))) {    return Error::handle(name(), L"operator *",			 Error::TEST, __FILE__, __LINE__);  }      // test operator /  //  if (!Integral::almostEqual(((double)r1 / c10) ,			     SysComplex<double>(0, -1.5152))) {    return Error::handle(name(), L"operator /",			 Error::TEST, __FILE__, __LINE__);  }     // test operator - (negation)  //  if (!Integral::almostEqual(-c10, SysComplex<double>(0, -3.3))) {    return Error::handle(name(), L"operator -",			 Error::TEST, __FILE__, __LINE__);  } //--------------------------------------------------------------------------- // // class-specific *public methods*: //  relational functions with TIntegral and complex types. since the //  complex arg is to the right these cannot be member functions. // //--------------------------------------------------------------------------- // set indentation //  if (level_a > Integral::NONE) {    Console::increaseIndention();  }  // test operator >  //    if (!(r1 > c10)) {    return Error::handle(name(), L"operator>",			 Error::TEST, __FILE__, __LINE__);  }    // test operator <  //  if (r1 < c10) {    return Error::handle(name(), L"operator<",			 Error::TEST, __FILE__, __LINE__);  }  // test operator >=  //  if (!(r1 >= c10)) {    return Error::handle(name(), L"operator>=",			 Error::TEST, __FILE__, __LINE__);  }      // test operator <=  //  if (r1 <= c10) {    return Error::handle(name(), L"operator<=",			 Error::TEST, __FILE__, __LINE__);  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();    Console::decreaseIndention();  }    // exit gracefully  //  return true;  }// method: diagnose2//// arguments://  Integral::DEBUG level: (input) debug level for diagnostics//// return: a boolean value indicating status//// this method performs diagnostics for the type "long"//template<class TObject>boolean SysComplexDiagnose<TObject>::diagnose2(Integral::DEBUG level_a) {  //----------------------------------------------------------------------  //  //  preliminaries  //  //----------------------------------------------------------------------  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    // output the class name  //  if (level_a > Integral::NONE) {    SysString output(L"diagnosing class ");    output.concat(CLASS_NAME);    output.concat(L" for the type long: ");    Console::put(output);  }    //---------------------------------------------------------------------  //  //  required public methods:  //  //---------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::increaseIndention();     Console::put      (L"testing class-specific public methods: required methods...\n");    Console::increaseIndention();  }  // test constructor  //  const SysComplex<long> c4(4, 2);  const SysComplex<long> c5(5);  const SysComplex<long> c6(0, 3);  SysComplex<long> t;  long r1 = 5;  // test copy constructor  //  SysComplex<long> c7(c4);  if (!Integral::almostEqual(c7, c4)) {    return Error::handle(name(), L"copy constructor",			 Error::TEST, __FILE__, __LINE__);  }    // test operator = (assignment)  //  c7 = c6;  if (!Integral::almostEqual(c7, c6)) {   return Error::handle(name(), L"operator=",			 Error::TEST, __FILE__, __LINE__);  }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }  //---------------------------------------------------------------------  //  // class-specific public methods: other constructors, assignment,  // casting, and component extraction methods  //  //---------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put      (L"testing class-specific public methods: assignment, casting...\n");    Console::increaseIndention();  }    // test assign  //  c7.assign(5, 6);  if (!Integral::almostEqual(c7, SysComplex<float>(5, 6))) {   return Error::handle(name(), L"assign",			 Error::TEST, __FILE__, __LINE__);  }    // test operator = (assignment)  //  c7 = t;  if (!Integral::almostEqual(c7, t)) {   return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }  // test cast operator  //  if (!Integral::almostEqual      (SysComplex<float>(c4) , SysComplex<float>(4, 2))) {    return Error::handle(name(), L"almostEqual",			 Error::TEST, __FILE__, __LINE__);  }    // test real  //  if (!Integral::almostEqual(c7.real(), (long)t.real())) {

⌨️ 快捷键说明

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