astyle fix
This commit is contained in:
parent
5a21fe7ae8
commit
a1d0defbc0
|
@ -2474,9 +2474,9 @@ void CheckOther::checkMathFunctions()
|
||||||
{
|
{
|
||||||
mathfunctionCallError(tok);
|
mathfunctionCallError(tok);
|
||||||
}
|
}
|
||||||
// acos( x ) x is defined for intervall [-1,+1], but not beyound
|
// acos( x ) x is defined for intervall [-1,+1], but not beyound
|
||||||
else if(Token::Match(tok, "acos ( %num% )") &&
|
else if (Token::Match(tok, "acos ( %num% )") &&
|
||||||
fabs(MathLib::toDoubleNumber(tok->tokAt(2)->str())) > 1.0)
|
fabs(MathLib::toDoubleNumber(tok->tokAt(2)->str())) > 1.0)
|
||||||
{
|
{
|
||||||
mathfunctionCallError(tok);
|
mathfunctionCallError(tok);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,11 +55,11 @@ double MathLib::toDoubleNumber(const std::string &str)
|
||||||
{
|
{
|
||||||
return std::strtoul(str.c_str(), '\0', 16);
|
return std::strtoul(str.c_str(), '\0', 16);
|
||||||
}
|
}
|
||||||
// nullcheck
|
// nullcheck
|
||||||
else if (str == "-0" || str == "-0.0" || str == "-0."
|
else if (str == "-0" || str == "-0.0" || str == "-0."
|
||||||
|| str == "+0" || str == "+0.0" || str == "+0.")
|
|| str == "+0" || str == "+0.0" || str == "+0.")
|
||||||
return 0.0;
|
return 0.0;
|
||||||
// otherwise, convert to double
|
// otherwise, convert to double
|
||||||
std::istringstream istr(str.c_str());
|
std::istringstream istr(str.c_str());
|
||||||
double ret;
|
double ret;
|
||||||
istr >> ret;
|
istr >> ret;
|
||||||
|
|
|
@ -116,9 +116,9 @@ private:
|
||||||
ASSERT_EQUALS(100 , MathLib::toLongNumber("+10.0E+1"));
|
ASSERT_EQUALS(100 , MathLib::toLongNumber("+10.0E+1"));
|
||||||
ASSERT_EQUALS(-1 , MathLib::toLongNumber("-10.0E-1"));
|
ASSERT_EQUALS(-1 , MathLib::toLongNumber("-10.0E-1"));
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
// to double number:
|
// to double number:
|
||||||
// -----------------
|
// -----------------
|
||||||
ASSERT_EQUALS(10.0 , MathLib::toDoubleNumber("10"));
|
ASSERT_EQUALS(10.0 , MathLib::toDoubleNumber("10"));
|
||||||
ASSERT_EQUALS(1000.0, MathLib::toDoubleNumber("10E+2"));
|
ASSERT_EQUALS(1000.0, MathLib::toDoubleNumber("10E+2"));
|
||||||
ASSERT_EQUALS(100.0 , MathLib::toDoubleNumber("1.0E+2"));
|
ASSERT_EQUALS(100.0 , MathLib::toDoubleNumber("1.0E+2"));
|
||||||
|
@ -135,7 +135,7 @@ private:
|
||||||
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0."));
|
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0."));
|
||||||
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0.0"));
|
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0.0"));
|
||||||
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0.0"));
|
ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0.0"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void isint()
|
void isint()
|
||||||
|
|
|
@ -2169,7 +2169,7 @@ private:
|
||||||
|
|
||||||
void mathfunctionCall1()
|
void mathfunctionCall1()
|
||||||
{
|
{
|
||||||
// log|log10
|
// log|log10
|
||||||
check("void foo()\n"
|
check("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" std::cout << log(-2) << std::endl;\n"
|
" std::cout << log(-2) << std::endl;\n"
|
||||||
|
@ -2230,7 +2230,7 @@ private:
|
||||||
"}");
|
"}");
|
||||||
TODO_ASSERT_EQUALS("", errout.str());
|
TODO_ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// acos
|
// acos
|
||||||
check("void foo()\n"
|
check("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" std::cout << acos(1) << std::endl;\n"
|
" std::cout << acos(1) << std::endl;\n"
|
||||||
|
|
|
@ -43,9 +43,9 @@ protected:
|
||||||
|
|
||||||
void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
||||||
|
|
||||||
// the vars expected and actual need to be of type double, in order to avoid overflow of unsigned int
|
// the vars expected and actual need to be of type double, in order to avoid overflow of unsigned int
|
||||||
// e.g: ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); whould not work without this.
|
// e.g: ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); whould not work without this.
|
||||||
void assertEquals(const char *filename, int linenr, double expected, double actual);
|
void assertEquals(const char *filename, int linenr, double expected, double actual);
|
||||||
|
|
||||||
void todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
void todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
||||||
void todoAssertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual);
|
void todoAssertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual);
|
||||||
|
|
Loading…
Reference in New Issue