void
static_initializer_test::test (cxx11_tag)
{
    testcase << "cxx11 " << Tag::count << " threads";

    Counts counts;

    run_many (Tag::count, [&]()
    {
        static Test <Tag> t (counts);
        t(counts);
    });

#ifdef _MSC_VER
    // Visual Studio 2013 and earlier can exhibit both double
    // construction, and access before construction when function
    // local statics are initialized concurrently.
    //
    expect (counts.constructed > 1 || counts.access > 0);

#else
    expect (counts.constructed == 1 && counts.access == 0);

#endif
}
void
static_initializer_test::test (beast_tag)
{
    testcase << "beast " << Tag::count << " threads";

    Counts counts;

    run_many (Tag::count, [&counts]()
    {
        static static_initializer <Test <Tag>> t (counts);
        (*t)(counts);
    });

    expect (counts.constructed == 1 && counts.access == 0);
}
Exemple #3
0
int main(void)
{
    return !run_many(tests, TEST_COUNT(tests));
}