gcc/libvtv/testsuite/libvtv.cc/bb_tests.cc
Caroline Tice 41e96dc8f0 Update libvtv testsuite so that most of the tests now run under
the dejagnu test harness.

From-SVN: r202373
2013-09-08 16:35:14 -07:00

54 lines
806 B
C++

// { dg-do run }
struct base
{
int total;
virtual void add (int i) { total += i; }
virtual void sub (int i) { total -= i; }
virtual void init (void) { total = 73; }
};
struct derived : public base
{
int total;
virtual void add (int i) { total += 10 * i; }
virtual void sub (int i) { total -= 2 * i; }
virtual void init (void) { total = 0; }
};
bool
get_cond_value (int x)
{
if ((x % 3) > 0)
return true;
else
return false;
return false;
}
int
main (int argc, char **argv)
{
base *a;
bool cond_value = get_cond_value (10);
int x;
if (cond_value)
a = new base ();
else
a = new derived ();
cond_value = get_cond_value (47);
x = 0;
if (!cond_value)
x = 17;
a->init ();
for ( ; x < 10; ++x)
{
a->add(50);
a->sub(25);
}
}