📄 syscomplexdiagnose.h
字号:
return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test imag // if (!Integral::almostEqual(c6.imag(), (long)3)) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test mag // if (!Integral::almostEqual((long)c4.mag(), (long)4.4721)) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test angle // if (!Integral::almostEqual((long)c4.angle(), (long)0)) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } //--------------------------------------------------------------------------- // // class-specific public methods: // accumulative arithmetic functions with SysComplex and TIntegral types // //--------------------------------------------------------------------------- // set indentation // if (level_a > Integral::NONE) { Console::put(L"testing class-specific public methods: accumulative...\n"); Console::increaseIndention(); } // test operator += // c7 = c6; c7 += c4; if (!Integral::almostEqual(c7 , SysComplex<long>(4, 5))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator -= // c7 = c6; c7 -= c4; if (!Integral::almostEqual(c7 , SysComplex<long>(-4, 1))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator *= // c7 = c5; c7 *= c4; if (!Integral::almostEqual(c7 , SysComplex<long>(20, 10))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator /= // c7 = c5; c7 /= c4; if (!Integral::almostEqual(c7 , SysComplex<long>(1, -0))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator += // c7 = c6; c7 += 2; if (!Integral::almostEqual(c7 , SysComplex<long>(2, 3))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator -= // c7 = c6; c7 -= 2; if (!Integral::almostEqual(c7 , SysComplex<long>(-2, 3))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator *= // c7 = c6; c7 *= 2; if (!Integral::almostEqual(c7 , SysComplex<long>(0, 6))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator /= // c7 = c6; c7 /= 2; if (!Integral::almostEqual(c7 , SysComplex<long>(0, 1))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator ++ (post-increment) // c7 = 4; c7 = c7++; if (c7 == 5) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator -- (post-decrement) // c7 = 4; c7 = c7--; if (c7 == 3) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator ++ (pre-increment) // c7 = 5; c7 = ++c7; if (c7 == 5) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test operator -- (pre-decrement) // c7 = 5; c7 = --c7; if (c7 == 5) { 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) // c7 = c6; if (!(c7 == c6)) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator != // c7 = c4; if (c7 != c4) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator < // if (c4 < c6) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator > // if (!(c4 > c6)) { return Error::handle(name(), L"operator>", Error::TEST, __FILE__, __LINE__); } // test operator <= // if (c4 <= c6) { return Error::handle(name(), L"operator<=", Error::TEST, __FILE__, __LINE__); } // test operator >= // if (!(c4 >= c6)) { return Error::handle(name(), L"operator>=", Error::TEST, __FILE__, __LINE__); } // test operator == // c7 = 5; if (!(c7 == 5)) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator != // c7 = 5; if (c7 != 5) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator < // if (r1 < c6) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator > // if (!(r1 > c6)) { return Error::handle(name(), L"operator>", Error::TEST, __FILE__, __LINE__); } // test operator <= // if (!(c4 <= r1)) { return Error::handle(name(), L"operator<=", Error::TEST, __FILE__, __LINE__); } // test operator >= // if (!(r1 >= c6)) { 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((c4 + c6), SysComplex<long>(4, 5))) { return Error::handle(name(), L"operator +", Error::TEST, __FILE__, __LINE__); } // test operator - // if (!Integral::almostEqual((c4 - c6), SysComplex<long>(4, -1))) { return Error::handle(name(), L"operator +", Error::TEST, __FILE__, __LINE__); } // test operator * // if (!Integral::almostEqual((c4 * c5), SysComplex<long>(20, 10))) { return Error::handle(name(), L"operator +", Error::TEST, __FILE__, __LINE__); } // test operator / // if (!Integral::almostEqual((c4 / c6), SysComplex<long>(0, -1))) { 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. // //--------------------------------------------------------------------------- // set indentation // if (level_a > Integral::NONE) { Console::put (L"testing class-specific public methods: complex to the left...\n"); Console::increaseIndention(); } // test operator + // if (!Integral::almostEqual((c4 + r1), SysComplex<long>(9, 2))) { return Error::handle(name(), L"operator +", Error::TEST, __FILE__, __LINE__); } // test operator - // if (!Integral::almostEqual((c6 - r1), SysComplex<long>(-5, 3))) { return Error::handle(name(), L"operator -", Error::TEST, __FILE__, __LINE__); } // test operator * // if (!Integral::almostEqual((c4 * r1), SysComplex<long>(20, 10))) { return Error::handle(name(), L"operator *", Error::TEST, __FILE__, __LINE__); } // test operator / if (!Integral::almostEqual((c4 / r1), SysComplex<long>(0, 0))) { return Error::handle(name(), L"operator /", Error::TEST, __FILE__, __LINE__); } // test inverse // if (!Integral::almostEqual(c4.inverse(), SysComplex<long>(0, 0))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // reset indentation // if (level_a > Integral::NONE) { 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(c4.conjugate(), SysComplex<long>(4, -2))) { return Error::handle(name(), L"almostEqual", Error::TEST, __FILE__, __LINE__); } // test polar // if (!Integral::almostEqual(c4.polar(4, 0), SysComplex<long>(4, 0))) { 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(((long)5 + c6), SysComplex<long>(5, 3))) { return Error::handle(name(), L"operator +", Error::TEST, __FILE__, __LINE__); } // test operator - // if (!Integral::almostEqual(((long)r1 - c6) , SysComplex<long>(5, -3))) { return Error::handle(name(), L"operator -", Error::TEST, __FILE__, __LINE__); } // test operator * // if (!Integral::almostEqual(((long)r1 * c4) , SysComplex<long>(20, 10))) { return Error::handle(name(), L"operator *", Error::TEST, __FILE__, __LINE__); } // test operator / // if (!Integral::almostEqual(((long)r1 / c6), SysComplex<long>(0, -1))) { return Error::handle(name(), L"operator /", Error::TEST, __FILE__, __LINE__); } // test operator - (negation) // if (!Integral::almostEqual(-c6, SysComplex<long>(0, -3))) { return Error::handle(name(), L"operator -", Error::TEST, __FILE__, __LINE__); } // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } //--------------------------------------------------------------------------- // // 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 > c6)) { return Error::handle(name(), L"operator>", Error::TEST, __FILE__, __LINE__); } // test operator < // if (r1 < c6) { return Error::handle(name(), L"operator<", Error::TEST, __FILE__, __LINE__); } // test operator >= // if (!(r1 >= c6)) { return Error::handle(name(), L"operator>=", Error::TEST, __FILE__, __LINE__); } // test operator <= // if (r1 <= c6) { return Error::handle(name(), L"operator<=", Error::TEST, __FILE__, __LINE__); } // reset indentation // if (level_a > Integral::NONE) { Console::decreaseIndention(); } // exit gracefully // return true;}// end of include file//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -