mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
tests: include global initializers in c++ compiler test
This commit is contained in:
parent
f1b14b91f1
commit
3f52132a8f
@ -12,15 +12,22 @@ private:
|
|||||||
int m_val;
|
int m_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
volatile int runtime_val = 456;
|
||||||
|
CTest global(runtime_val); // test if global initializers are called.
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
assert(global.getVal() == 456);
|
||||||
|
|
||||||
auto* t = new CTest(123);
|
auto* t = new CTest(123);
|
||||||
assert(t->getVal()!=456);
|
assert(t->getVal()!=456);
|
||||||
if (argc>1) t->printVal();
|
|
||||||
|
if (argc>1) t->printVal();
|
||||||
bool ok = t->getVal() == 123;
|
bool ok = t->getVal() == 123;
|
||||||
delete t;
|
delete t;
|
||||||
|
|
||||||
if (!ok) abort();
|
if (!ok) abort();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user