Corrections for non-Microsoft compilers
This commit is contained in:
parent
649a89d308
commit
56e90f95d9
|
@ -197,13 +197,13 @@ void CheckOther::checkCastIntToCharAndBack()
|
|||
if (var && var->typeEndToken()->str() == "char" && !var->typeEndToken()->isSigned()) {
|
||||
checkCastIntToCharAndBackError(tok, tok->strAt(2));
|
||||
}
|
||||
} else if (_tokenizer->isCPP() && Token::Match(tok, "EOF %comp% ( %var% = std :: cin . get (") || Token::Match(tok, "EOF %comp% ( %var% = cin . get (")) {
|
||||
} else if (_tokenizer->isCPP() && (Token::Match(tok, "EOF %comp% ( %var% = std :: cin . get (") || Token::Match(tok, "EOF %comp% ( %var% = cin . get ("))) {
|
||||
tok = tok->tokAt(3);
|
||||
const Variable *var = tok->variable();
|
||||
if (var && var->typeEndToken()->str() == "char" && !var->typeEndToken()->isSigned()) {
|
||||
checkCastIntToCharAndBackError(tok, "cin.get");
|
||||
}
|
||||
} else if (_tokenizer->isCPP() && Token::Match(tok, "%var% = std :: cin . get (") || Token::Match(tok, "%var% = cin . get (")) {
|
||||
} else if (_tokenizer->isCPP() && (Token::Match(tok, "%var% = std :: cin . get (") || Token::Match(tok, "%var% = cin . get ("))) {
|
||||
const Variable *var = tok->variable();
|
||||
if (var && var->typeEndToken()->str() == "char" && !var->typeEndToken()->isSigned()) {
|
||||
vars[tok->varId()] = "cin.get";
|
||||
|
|
|
@ -267,8 +267,8 @@ private:
|
|||
|
||||
ASSERT_EQUALS(-8552249625308161526, MathLib::toLongNumber("0x89504e470d0a1a0a"));
|
||||
ASSERT_EQUALS(-8481036456200365558, MathLib::toLongNumber("0x8a4d4e470d0a1a0a"));
|
||||
ASSERT_EQUALS(9894494448401390090, MathLib::toULongNumber("0x89504e470d0a1a0a"));
|
||||
ASSERT_EQUALS(9965707617509186058, MathLib::toULongNumber("0x8a4d4e470d0a1a0a"));
|
||||
ASSERT_EQUALS(9894494448401390090ULL, MathLib::toULongNumber("0x89504e470d0a1a0a"));
|
||||
ASSERT_EQUALS(9965707617509186058ULL, MathLib::toULongNumber("0x8a4d4e470d0a1a0a"));
|
||||
|
||||
// zero input
|
||||
ASSERT_EQUALS(0 , MathLib::toULongNumber("0"));
|
||||
|
@ -286,7 +286,12 @@ private:
|
|||
ASSERT_EQUALS(5U, MathLib::toULongNumber("0b101"));
|
||||
|
||||
// from long long
|
||||
ASSERT_EQUALS(0xFF00000000000000LL, MathLib::toLongNumber("0xFF00000000000000LL"));
|
||||
/*
|
||||
* ASSERT_EQUALS(0xFF00000000000000LL, MathLib::toLongNumber("0xFF00000000000000LL"));
|
||||
* This does not work in a portable way!
|
||||
* While it succeds on 32bit Visual Studio it fails on Linux 64bit because it is greater than 0x7FFFFFFFFFFFFFFF (=LLONG_MAX)
|
||||
*/
|
||||
|
||||
ASSERT_EQUALS(0x0A00000000000000LL, MathLib::toLongNumber("0x0A00000000000000LL"));
|
||||
|
||||
// -----------------
|
||||
|
|
|
@ -156,6 +156,24 @@ void TestFixture::_assertEquals(const char *filename, unsigned int linenr, const
|
|||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, std::string(expected), actual, msg);
|
||||
}
|
||||
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, std::string(expected), std::string(actual), msg);
|
||||
}
|
||||
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, expected, std::string(actual), msg);
|
||||
}
|
||||
|
||||
void TestFixture::assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, MathLib::toString(expected), MathLib::toString(actual), msg);
|
||||
|
|
|
@ -58,29 +58,6 @@ protected:
|
|||
_assertEquals(filename, linenr, MathLib::toString(expected), MathLib::toString(actual), msg);
|
||||
}
|
||||
|
||||
template<>
|
||||
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, std::string(expected), actual, msg);
|
||||
}
|
||||
template<>
|
||||
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, std::string(expected), std::string(actual), msg);
|
||||
}
|
||||
template<>
|
||||
void assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const
|
||||
{
|
||||
assertEquals(filename, linenr, expected, std::string(actual), msg);
|
||||
}
|
||||
/*
|
||||
void assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const;
|
||||
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const;
|
||||
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const;
|
||||
void assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const;
|
||||
void assertEquals(const char *filename, unsigned int linenr, long long expected, long long actual, const std::string &msg = emptyString) const;
|
||||
void assertEquals(const char *filename, unsigned int linenr, unsigned long long expected, unsigned long long actual, const std::string &msg = emptyString) const;
|
||||
*/
|
||||
void assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg = emptyString) const;
|
||||
|
||||
void todoAssertEquals(const char *filename, unsigned int linenr, const std::string &wanted,
|
||||
|
@ -104,6 +81,13 @@ public:
|
|||
static std::size_t runTests(const options& args);
|
||||
};
|
||||
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const;
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const;
|
||||
template<>
|
||||
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const;
|
||||
|
||||
extern std::ostringstream errout;
|
||||
extern std::ostringstream output;
|
||||
extern std::ostringstream warnings;
|
||||
|
|
Loading…
Reference in New Issue