Fixed VS warnings in testsymboldatabase.cpp
This commit is contained in:
parent
d3dbfad131
commit
4f61e9783b
|
@ -2245,115 +2245,155 @@ private:
|
||||||
void varTypesIntegral() {
|
void varTypesIntegral() {
|
||||||
GET_SYMBOL_DB("void f() { bool b; char c; unsigned char uc; short s; unsigned short us; int i; unsigned u; unsigned int ui; long l; unsigned long ul; long long ll; }");
|
GET_SYMBOL_DB("void f() { bool b; char c; unsigned char uc; short s; unsigned short us; int i; unsigned u; unsigned int ui; long l; unsigned long ul; long long ll; }");
|
||||||
const Variable *b = db->getVariableFromVarId(1);
|
const Variable *b = db->getVariableFromVarId(1);
|
||||||
ASSERT(b);
|
ASSERT(b != nullptr);
|
||||||
|
if (b) {
|
||||||
ASSERT_EQUALS("b", b->nameToken()->str());
|
ASSERT_EQUALS("b", b->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, b->isIntegralType());
|
ASSERT_EQUALS(true, b->isIntegralType());
|
||||||
ASSERT_EQUALS(false, b->isFloatingType());
|
ASSERT_EQUALS(false, b->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *c = db->getVariableFromVarId(2);
|
const Variable *c = db->getVariableFromVarId(2);
|
||||||
ASSERT(c);
|
ASSERT(c != nullptr);
|
||||||
|
if (c) {
|
||||||
ASSERT_EQUALS("c", c->nameToken()->str());
|
ASSERT_EQUALS("c", c->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, c->isIntegralType());
|
ASSERT_EQUALS(true, c->isIntegralType());
|
||||||
ASSERT_EQUALS(false, c->isFloatingType());
|
ASSERT_EQUALS(false, c->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *uc = db->getVariableFromVarId(3);
|
const Variable *uc = db->getVariableFromVarId(3);
|
||||||
ASSERT(uc);
|
ASSERT(uc != nullptr);
|
||||||
|
if (uc) {
|
||||||
ASSERT_EQUALS("uc", uc->nameToken()->str());
|
ASSERT_EQUALS("uc", uc->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, uc->isIntegralType());
|
ASSERT_EQUALS(true, uc->isIntegralType());
|
||||||
ASSERT_EQUALS(false, uc->isFloatingType());
|
ASSERT_EQUALS(false, uc->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *s = db->getVariableFromVarId(4);
|
const Variable *s = db->getVariableFromVarId(4);
|
||||||
ASSERT(s);
|
ASSERT(s != nullptr);
|
||||||
|
if (s) {
|
||||||
ASSERT_EQUALS("s", s->nameToken()->str());
|
ASSERT_EQUALS("s", s->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, s->isIntegralType());
|
ASSERT_EQUALS(true, s->isIntegralType());
|
||||||
ASSERT_EQUALS(false, s->isFloatingType());
|
ASSERT_EQUALS(false, s->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *us = db->getVariableFromVarId(5);
|
const Variable *us = db->getVariableFromVarId(5);
|
||||||
ASSERT(us);
|
ASSERT(us != nullptr);
|
||||||
|
if (us) {
|
||||||
ASSERT_EQUALS("us", us->nameToken()->str());
|
ASSERT_EQUALS("us", us->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, us->isIntegralType());
|
ASSERT_EQUALS(true, us->isIntegralType());
|
||||||
ASSERT_EQUALS(false, us->isFloatingType());
|
ASSERT_EQUALS(false, us->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *i = db->getVariableFromVarId(6);
|
const Variable *i = db->getVariableFromVarId(6);
|
||||||
ASSERT(i);
|
ASSERT(i != nullptr);
|
||||||
|
if (i) {
|
||||||
ASSERT_EQUALS("i", i->nameToken()->str());
|
ASSERT_EQUALS("i", i->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, i->isIntegralType());
|
ASSERT_EQUALS(true, i->isIntegralType());
|
||||||
ASSERT_EQUALS(false, i->isFloatingType());
|
ASSERT_EQUALS(false, i->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *u = db->getVariableFromVarId(7);
|
const Variable *u = db->getVariableFromVarId(7);
|
||||||
ASSERT(u);
|
ASSERT(u != nullptr);
|
||||||
|
if (u) {
|
||||||
ASSERT_EQUALS("u", u->nameToken()->str());
|
ASSERT_EQUALS("u", u->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, u->isIntegralType());
|
ASSERT_EQUALS(true, u->isIntegralType());
|
||||||
ASSERT_EQUALS(false, u->isFloatingType());
|
ASSERT_EQUALS(false, u->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *ui = db->getVariableFromVarId(8);
|
const Variable *ui = db->getVariableFromVarId(8);
|
||||||
ASSERT(ui);
|
ASSERT(ui != nullptr);
|
||||||
|
if (ui) {
|
||||||
ASSERT_EQUALS("ui", ui->nameToken()->str());
|
ASSERT_EQUALS("ui", ui->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, ui->isIntegralType());
|
ASSERT_EQUALS(true, ui->isIntegralType());
|
||||||
ASSERT_EQUALS(false, ui->isFloatingType());
|
ASSERT_EQUALS(false, ui->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *l = db->getVariableFromVarId(9);
|
const Variable *l = db->getVariableFromVarId(9);
|
||||||
ASSERT(l);
|
ASSERT(l != nullptr);
|
||||||
|
if (l) {
|
||||||
ASSERT_EQUALS("l", l->nameToken()->str());
|
ASSERT_EQUALS("l", l->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, l->isIntegralType());
|
ASSERT_EQUALS(true, l->isIntegralType());
|
||||||
ASSERT_EQUALS(false, l->isFloatingType());
|
ASSERT_EQUALS(false, l->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *ul = db->getVariableFromVarId(10);
|
const Variable *ul = db->getVariableFromVarId(10);
|
||||||
ASSERT(ul);
|
ASSERT(ul != nullptr);
|
||||||
|
if (ul) {
|
||||||
ASSERT_EQUALS("ul", ul->nameToken()->str());
|
ASSERT_EQUALS("ul", ul->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, ul->isIntegralType());
|
ASSERT_EQUALS(true, ul->isIntegralType());
|
||||||
ASSERT_EQUALS(false, ul->isFloatingType());
|
ASSERT_EQUALS(false, ul->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *ll = db->getVariableFromVarId(11);
|
const Variable *ll = db->getVariableFromVarId(11);
|
||||||
ASSERT(ui);
|
ASSERT(ui != nullptr);
|
||||||
|
if (ui) {
|
||||||
ASSERT_EQUALS("ll", ll->nameToken()->str());
|
ASSERT_EQUALS("ll", ll->nameToken()->str());
|
||||||
ASSERT_EQUALS(true, ll->isIntegralType());
|
ASSERT_EQUALS(true, ll->isIntegralType());
|
||||||
ASSERT_EQUALS(false, ll->isFloatingType());
|
ASSERT_EQUALS(false, ll->isFloatingType());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void varTypesFloating() {
|
void varTypesFloating() {
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("void f() { float f; double d; long double ld; }");
|
GET_SYMBOL_DB("void f() { float f; double d; long double ld; }");
|
||||||
const Variable *f = db->getVariableFromVarId(1);
|
const Variable *f = db->getVariableFromVarId(1);
|
||||||
ASSERT(f);
|
ASSERT(f != nullptr);
|
||||||
|
if (f) {
|
||||||
ASSERT_EQUALS("f", f->nameToken()->str());
|
ASSERT_EQUALS("f", f->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, f->isIntegralType());
|
ASSERT_EQUALS(false, f->isIntegralType());
|
||||||
ASSERT_EQUALS(true, f->isFloatingType());
|
ASSERT_EQUALS(true, f->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *d = db->getVariableFromVarId(2);
|
const Variable *d = db->getVariableFromVarId(2);
|
||||||
ASSERT(d);
|
ASSERT(d != nullptr);
|
||||||
|
if (d) {
|
||||||
ASSERT_EQUALS("d", d->nameToken()->str());
|
ASSERT_EQUALS("d", d->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, d->isIntegralType());
|
ASSERT_EQUALS(false, d->isIntegralType());
|
||||||
ASSERT_EQUALS(true, d->isFloatingType());
|
ASSERT_EQUALS(true, d->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *ld = db->getVariableFromVarId(3);
|
const Variable *ld = db->getVariableFromVarId(3);
|
||||||
ASSERT(ld);
|
ASSERT(ld != nullptr);
|
||||||
|
if (ld) {
|
||||||
ASSERT_EQUALS("ld", ld->nameToken()->str());
|
ASSERT_EQUALS("ld", ld->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, ld->isIntegralType());
|
ASSERT_EQUALS(false, ld->isIntegralType());
|
||||||
ASSERT_EQUALS(true, ld->isFloatingType());
|
ASSERT_EQUALS(true, ld->isFloatingType());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("void f() { float * f; static const float * scf; }");
|
GET_SYMBOL_DB("void f() { float * f; static const float * scf; }");
|
||||||
const Variable *f = db->getVariableFromVarId(1);
|
const Variable *f = db->getVariableFromVarId(1);
|
||||||
ASSERT(f);
|
ASSERT(f != nullptr);
|
||||||
|
if (f) {
|
||||||
ASSERT_EQUALS("f", f->nameToken()->str());
|
ASSERT_EQUALS("f", f->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, f->isIntegralType());
|
ASSERT_EQUALS(false, f->isIntegralType());
|
||||||
ASSERT_EQUALS(false, f->isFloatingType());
|
ASSERT_EQUALS(false, f->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *scf = db->getVariableFromVarId(2);
|
const Variable *scf = db->getVariableFromVarId(2);
|
||||||
ASSERT(scf);
|
ASSERT(scf != nullptr);
|
||||||
|
if (scf) {
|
||||||
ASSERT_EQUALS("scf", scf->nameToken()->str());
|
ASSERT_EQUALS("scf", scf->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, scf->isIntegralType());
|
ASSERT_EQUALS(false, scf->isIntegralType());
|
||||||
ASSERT_EQUALS(false, scf->isFloatingType());
|
ASSERT_EQUALS(false, scf->isFloatingType());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("void f() { float fa[42]; }");
|
GET_SYMBOL_DB("void f() { float fa[42]; }");
|
||||||
const Variable *fa = db->getVariableFromVarId(1);
|
const Variable *fa = db->getVariableFromVarId(1);
|
||||||
ASSERT(fa);
|
ASSERT(fa != nullptr);
|
||||||
|
if (fa) {
|
||||||
ASSERT_EQUALS("fa", fa->nameToken()->str());
|
ASSERT_EQUALS("fa", fa->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, fa->isIntegralType());
|
ASSERT_EQUALS(false, fa->isIntegralType());
|
||||||
ASSERT_EQUALS(false, fa->isFloatingType());
|
ASSERT_EQUALS(false, fa->isFloatingType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void varTypesOther() {
|
void varTypesOther() {
|
||||||
GET_SYMBOL_DB("void f() { class A {} a; void *b; }");
|
GET_SYMBOL_DB("void f() { class A {} a; void *b; }");
|
||||||
const Variable *a = db->getVariableFromVarId(1);
|
const Variable *a = db->getVariableFromVarId(1);
|
||||||
|
ASSERT(a != nullptr);
|
||||||
|
if (a) {
|
||||||
ASSERT_EQUALS("a", a->nameToken()->str());
|
ASSERT_EQUALS("a", a->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, a->isIntegralType());
|
ASSERT_EQUALS(false, a->isIntegralType());
|
||||||
ASSERT_EQUALS(false, a->isFloatingType());
|
ASSERT_EQUALS(false, a->isFloatingType());
|
||||||
|
}
|
||||||
const Variable *b = db->getVariableFromVarId(2);
|
const Variable *b = db->getVariableFromVarId(2);
|
||||||
|
ASSERT(b != nullptr);
|
||||||
|
if (b) {
|
||||||
ASSERT_EQUALS("b", b->nameToken()->str());
|
ASSERT_EQUALS("b", b->nameToken()->str());
|
||||||
ASSERT_EQUALS(false, b->isIntegralType());
|
ASSERT_EQUALS(false, b->isIntegralType());
|
||||||
ASSERT_EQUALS(false, b->isFloatingType());
|
ASSERT_EQUALS(false, b->isFloatingType());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestSymbolDatabase)
|
REGISTER_TEST(TestSymbolDatabase)
|
||||||
|
|
Loading…
Reference in New Issue