// make the test suite
//
ArchiveTestSuite *ArchiveTestSuite::makeSuite()
{
    typedef wxArrayString::iterator Iter;

    for (int generic = 0; generic < 2; generic++)
        for (Iter i = m_unarchivers.begin(); i != m_unarchivers.end(); ++i)
            for (Iter j = m_archivers.begin(); j != m_archivers.end(); ++j)
                for (int options = 0; options <= AllOptions; options++)
                {
#ifdef WXARC_NO_POPEN
                    // if no popen then can't pipe in/out of archiver
                    if ((options & PipeIn) && !i->empty())
                        continue;
                    if ((options & PipeOut) && !j->empty())
                        continue;
#endif
                    string descr = Description(m_name, options,
                                               generic != 0, *j, *i);

                    CppUnit::Test *test = makeTest(descr, m_id, options,
                                                   generic != 0, *j, *i);

                    if (test) {
                        addTest(test);
                        m_id++;
                    }
                }

    return this;
}
Exemple #2
0
// make the test suite
//
ArchiveTestSuite *ArchiveTestSuite::makeSuite()
{
    typedef wxArrayString::iterator Iter;

    for (int generic = 0; generic < 2; generic++)
        for (Iter i = m_unarchivers.begin(); i != m_unarchivers.end(); ++i)
            for (Iter j = m_archivers.begin(); j != m_archivers.end(); ++j)
                for (int options = 0; options <= AllOptions; options++)
                {
#ifdef WXARC_NO_POPEN
                    // if no popen then can't pipe in/out of archiver
                    if ((options & PipeIn) && !i->empty())
                        continue;
                    if ((options & PipeOut) && !j->empty())
                        continue;
#endif
                    string descr = Description(m_name, options,
                                               generic != 0, *j, *i);

                    CppUnit::Test *test = makeTest(descr, options,
                                                   generic != 0, *j, *i);

                    if (test)
                        addTest(test);
                }

    for (int options = 0; options <= PipeIn; options += PipeIn)
    {
        wxObject *pObj = wxCreateDynamicObject(m_name + _T("ClassFactory"));
        wxArchiveClassFactory *factory;
        factory = wxDynamicCast(pObj, wxArchiveClassFactory);

        if (factory) {
            string descr(m_name.mb_str());
            descr = "CorruptionTestCase (" + descr + ")";

            if (options)
                descr += " (PipeIn)";

            addTest(new CorruptionTestCase(descr, factory, options));
        }
    }

    return this;
}