//-*****************************************************************************
void testWeirdStringScalar()
{
    std::string archiveName = "weirdStr.abc";

    Alembic::Util::string weirdStr = "Total failure";
    weirdStr[5] = '\0';

    Alembic::Util::wstring weirdWstr = L"Failure is always an option";
    weirdWstr[5] = L'\0';

    std::vector < Alembic::Util::string > weirdStrArray(3);
    weirdStrArray[0] = "watch";
    weirdStrArray[1] = "this";
    weirdStrArray[2] = "please";
    weirdStrArray[2][3] = '\0';

    Alembic::Util::string empty;
    Alembic::Util::wstring wempty;

    std::vector < Alembic::Util::string > allEmptyStr(3);

    std::vector < Alembic::Util::string > partEmptyStr(6);
    partEmptyStr[0] = "";
    partEmptyStr[1] = "";
    partEmptyStr[2] = "notEmpty!";
    partEmptyStr[3] = "";
    partEmptyStr[4] = "also not empty";
    partEmptyStr[5] = "";

    {
        A5::WriteArchive w;
        AbcA::ArchiveWriterPtr a = w(archiveName, AbcA::MetaData());
        AbcA::ObjectWriterPtr archive = a->getTop();

        AbcA::CompoundPropertyWriterPtr props = archive->getProperties();

        {

            AbcA::ScalarPropertyWriterPtr emptyWrtPtr =
                props->createScalarProperty("empty", AbcA::MetaData(),
                    AbcA::DataType(Alembic::Util::kStringPOD, 1), 0);

            // this should fail because of the NULL char in the string
            TESTING_ASSERT_THROW(emptyWrtPtr->setSample(&weirdStr),
                Alembic::Util::Exception);

            emptyWrtPtr->setSample(&empty);

            AbcA::ScalarPropertyWriterPtr wemptyWrtPtr =
                props->createScalarProperty("wempty", AbcA::MetaData(),
                    AbcA::DataType(Alembic::Util::kWstringPOD, 1), 0);

            // this should fail because of the NULL char in the string
            TESTING_ASSERT_THROW(wemptyWrtPtr->setSample(&weirdWstr),
                                 Alembic::Util::Exception);

            wemptyWrtPtr->setSample(&wempty);


            AbcA::ScalarPropertyWriterPtr allEmptyWrtPtr =
                props->createScalarProperty("allEmpty", AbcA::MetaData(),
                    AbcA::DataType(Alembic::Util::kStringPOD, 3), 0);

            // one of the strings has a NULL char in it
            TESTING_ASSERT_THROW(
                allEmptyWrtPtr->setSample(&(weirdStrArray.front())),
                Alembic::Util::Exception);

            allEmptyWrtPtr->setSample(&(allEmptyStr.front()));

            AbcA::ScalarPropertyWriterPtr partEmptyStrPtr =
                props->createScalarProperty("partEmpty", AbcA::MetaData(),
                    AbcA::DataType(Alembic::Util::kStringPOD, 6), 0);

            partEmptyStrPtr->setSample(&(partEmptyStr.front()));
        }
    }

    {
        A5::ReadArchive r;
        AbcA::ArchiveReaderPtr a = r( archiveName );
        AbcA::ObjectReaderPtr archive = a->getTop();
        AbcA::CompoundPropertyReaderPtr parent = archive->getProperties();

        for (size_t i = 0; i < parent->getNumProperties(); ++i)
        {
            AbcA::BasePropertyReaderPtr bp = parent->getProperty( i );
            if (bp->getName() == "partEmpty")
            {
                std::vector < Alembic::Util::string > val (6);
                AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
                TESTING_ASSERT(sp->getDataType().getExtent() == 6);
                sp->getSample(0, &(val.front()));
                TESTING_ASSERT(val == partEmptyStr);
            }
            else if (bp->getName() == "allEmpty")
            {
                std::vector < Alembic::Util::string > val (3);
                AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
                TESTING_ASSERT(sp->getDataType().getExtent() == 3);
                sp->getSample(0, &(val.front()));
                TESTING_ASSERT(val == allEmptyStr);
            }
            else if (bp->getName() == "empty")
            {
                Alembic::Util::string val;
                AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
                sp->getSample(0, &val);
                TESTING_ASSERT(val == empty);
            }
            else if (bp->getName() == "wempty")
            {
                Alembic::Util::wstring val;
                AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
                sp->getSample(0, &val);
                TESTING_ASSERT(val == wempty);
            }
            else
            {
                TESTING_ASSERT(false);
            }
        }

    }
}
//-*****************************************************************************
void testTimeSamplingScalar()
{
    std::string archiveName = "timeSamplingScalar.abc";
    {
        A5::WriteArchive w;
        AbcA::ArchiveWriterPtr a = w(archiveName, AbcA::MetaData());
        AbcA::ObjectWriterPtr archive = a->getTop();

        AbcA::CompoundPropertyWriterPtr parent = archive->getProperties();

        // illegal time value
        TESTING_ASSERT_THROW(parent->createScalarProperty("uniform",
            AbcA::MetaData(), AbcA::DataType(Alembic::Util::kInt32POD, 1), 42),
            Alembic::Util::Exception);

        std::vector < double > timeSamps(1,-4.0);
        AbcA::TimeSamplingType tst(3.0);
        AbcA::TimeSampling ts(tst, timeSamps);
        uint32_t tsid = a->addTimeSampling(ts);

        AbcA::ScalarPropertyWriterPtr swp =
            parent->createScalarProperty("uniform", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kInt32POD, 1), tsid);

        Alembic::Util::int32_t i = 0;

        swp->setSample(&i);

        i+=3;
        swp->setSample(&i);

        i+=3;
        swp->setSample(&i);

        timeSamps.clear();
        timeSamps.push_back(4.0);
        timeSamps.push_back(4.25);
        timeSamps.push_back(4.5);
        tst = AbcA::TimeSamplingType(3, 2.0);
        ts = AbcA::TimeSampling(tst, timeSamps);
        tsid = a->addTimeSampling(ts);

        AbcA::ScalarPropertyWriterPtr swp2 =
            parent->createScalarProperty("cyclic", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kUint32POD, 1), tsid);

        Alembic::Util::uint32_t ui = 0;

        swp2->setSample(&ui);

        ui++;
        swp2->setSample(&ui);

        ui++;
        swp2->setSample(&ui);

        ui++;
        swp2->setSample(&ui);

        ui++;
        swp2->setSample(&ui);

        ui++;
        swp2->setSample(&ui);

        timeSamps.clear();
        timeSamps.push_back(-17.0);
        timeSamps.push_back(32.0);
        timeSamps.push_back(50.0);
        timeSamps.push_back(60.2);
        timeSamps.push_back(101.1);
        timeSamps.push_back(700.0);
        timeSamps.push_back(747.0);

        tst = AbcA::TimeSamplingType(AbcA::TimeSamplingType::kAcyclic);
        ts = AbcA::TimeSampling(tst, timeSamps);
        tsid = a->addTimeSampling(ts);

        AbcA::ScalarPropertyWriterPtr swp3 =
            parent->createScalarProperty("acyclic", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kUint16POD, 1), tsid);

        Alembic::Util::uint16_t s = 0;
        swp3->setSample(&s);

        s++;
        swp3->setSample(&s);

        s++;

        swp3->setSample(&s);


        s++;
        swp3->setSample(&s);

        s++;
        swp3->setSample(&s);

        s++;
        swp3->setSample(&s);

        s++;
        swp3->setSample(&s);

        // Setting more than what we have acyclic samples for
        TESTING_ASSERT_THROW(swp3->setSample(&s),
            Alembic::Util::Exception);

        AbcA::ScalarPropertyWriterPtr swp4 =
            parent->createScalarProperty("identity", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kInt16POD, 1), 0);

        Alembic::Util::int16_t ss = 35;


        swp4->setSample(&ss);

        ss = 37;
        swp4->setSample(&ss);

        ss = 1000;
        swp4->setSample(&ss);

        timeSamps.clear();
        timeSamps.push_back(0.0);
        tst = AbcA::TimeSamplingType(1.0);
        ts = AbcA::TimeSampling(tst, timeSamps);
        tsid = a->addTimeSampling(ts);

        AbcA::ScalarPropertyWriterPtr swp5 =
            parent->createScalarProperty("defaultUniform", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kFloat32POD, 1), tsid);

        Alembic::Util::float32_t f = 0;

        swp5->setSample(&f);

        f+=1.1;
        swp5->setSample(&f);

        f+=1.1;
        swp5->setSample(&f);

        f+=1.1;
        swp5->setSample(&f);
    }

    {
        A5::ReadArchive r;
        AbcA::ArchiveReaderPtr a = r( archiveName );
        AbcA::ObjectReaderPtr archive = a->getTop();
        AbcA::CompoundPropertyReaderPtr parent = archive->getProperties();
        TESTING_ASSERT(parent->getNumProperties() == 5);

        for ( size_t i = 0; i < parent->getNumProperties(); ++i)
        {
            AbcA::BasePropertyReaderPtr bp = parent->getProperty( i );
            AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
            const AbcA::TimeSamplingPtr t = sp->getTimeSampling();

            switch (sp->getDataType().getPod())
            {
                case Alembic::Util::kInt16POD:
                {
                    // identity
                    TESTING_ASSERT( t->getTimeSamplingType().isUniform() );
                }
                break;

                case Alembic::Util::kUint16POD:
                {
                    // acylic
                    TESTING_ASSERT( t->getSampleTime(0) == -17.0 );
                    TESTING_ASSERT( sp->getNumSamples() == 7);
                    TESTING_ASSERT( t->getTimeSamplingType().isAcyclic() );
                    TESTING_ASSERT( t->getSampleTime(1) == 32.0 );
                    TESTING_ASSERT( t->getSampleTime(2) == 50.0 );
                    TESTING_ASSERT( t->getSampleTime(3) == 60.2 );
                    TESTING_ASSERT( t->getSampleTime(4) == 101.1 );
                    TESTING_ASSERT( t->getSampleTime(5) == 700.0 );
                    TESTING_ASSERT( t->getSampleTime(6) == 747.0 );
                    TESTING_ASSERT_THROW( t->getSampleTime(7),
                        Alembic::Util::Exception);
                }
                break;

                case Alembic::Util::kFloat32POD:
                {
                    TESTING_ASSERT( sp->getNumSamples() == 4);
                    TESTING_ASSERT( t->getTimeSamplingType().isUniform() );
                    TESTING_ASSERT( t->getSampleTime(0) == 0.0 );
                    TESTING_ASSERT( t->getSampleTime(1) == 1.0 );
                    TESTING_ASSERT( t->getSampleTime(2) == 2.0 );
                    TESTING_ASSERT( t->getSampleTime(3) == 3.0 );
                }
                break;

                case Alembic::Util::kInt32POD:
                {
                    // uniform
                    TESTING_ASSERT( sp->getNumSamples() == 3);
                    TESTING_ASSERT( t->getTimeSamplingType().isUniform() );
                    TESTING_ASSERT( t->getSampleTime(0) == -4.0 );
                    TESTING_ASSERT( t->getSampleTime(1) == -1.0 );
                    TESTING_ASSERT( t->getSampleTime(2) == 2.0 );
                }
                break;

                case Alembic::Util::kUint32POD:
                {
                    // cyclic
                    TESTING_ASSERT( sp->getNumSamples() == 6);
                    TESTING_ASSERT( t->getTimeSamplingType().isCyclic() );
                    TESTING_ASSERT( t->getSampleTime(0) == 4.0 );
                    TESTING_ASSERT( t->getSampleTime(1) == 4.25 );
                    TESTING_ASSERT( t->getSampleTime(2) == 4.5 );
                    TESTING_ASSERT( t->getSampleTime(3) == 6.0 );
                    TESTING_ASSERT( t->getSampleTime(4) == 6.25 );
                    TESTING_ASSERT( t->getSampleTime(5) == 6.5 );
                }
                break;

                default:
                    TESTING_ASSERT(false);
                break;
            }
        }  // for
    }
}
//-*****************************************************************************
void testRepeatedScalarData()
{
    std::string archiveName = "repeatScalarData.abc";

    {
        A5::WriteArchive w;
        AbcA::ArchiveWriterPtr a = w(archiveName, AbcA::MetaData());
        AbcA::ObjectWriterPtr archive = a->getTop();

        AbcA::CompoundPropertyWriterPtr parent = archive->getProperties();

        AbcA::ScalarPropertyWriterPtr swp =
            parent->createScalarProperty("int32", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kInt32POD, 3), 0);

        std::vector <Alembic::Util::uint32_t> ui(3);
        ui[0] = 0;
        ui[1] = 1;
        ui[2] = 2;

        std::vector <Alembic::Util::uint32_t> ui2(3);
        ui2[0] = 41;
        ui2[1] = 43;
        ui2[2] = 47;

        swp->setSample(&(ui.front()));
        swp->setSample(&(ui.front()));
        swp->setSample(&(ui2.front()));
        swp->setSample(&(ui.front()));
        swp->setSample(&(ui2.front()));
        swp->setSample(&(ui2.front()));
        swp->setSample(&(ui2.front()));
        swp->setSample(&(ui.front()));
        swp->setSample(&(ui.front()));
        swp->setSample(&(ui.front()));

        AbcA::ScalarPropertyWriterPtr swp2 =
            parent->createScalarProperty("float32", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kFloat32POD, 1), 0);

        Alembic::Util::float32_t f = 42.0;
        Alembic::Util::float32_t f2 = -3.0;

        swp2->setSample(&f);
        swp2->setSample(&f);
        swp2->setSample(&f);
        swp2->setSample(&f2);
        swp2->setSample(&f2);
        swp2->setSample(&f2);

        AbcA::ScalarPropertyWriterPtr swp3 =
            parent->createScalarProperty("uint16", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kUint16POD, 1), 0);

        Alembic::Util::uint16_t ui16 = 17;

        swp3->setSample(&ui16);
        swp3->setSample(&ui16);
        swp3->setSample(&ui16);
        swp3->setSample(&ui16);

        AbcA::ScalarPropertyWriterPtr swp4 =
            parent->createScalarProperty("str", AbcA::MetaData(),
                AbcA::DataType(Alembic::Util::kStringPOD, 3), 0);

        std::vector < Alembic::Util::string > strVec(3);
        strVec[0] = "Please";
        strVec[1] = "";
        strVec[2] = "work";

        std::vector < Alembic::Util::string > strVec2(3);
        strVec2[0] = "Whats";
        strVec2[1] = "going";
        strVec2[2] = "on?";

        swp4->setSample(&(strVec.front()));
        swp4->setSample(&(strVec.front()));
        swp4->setSample(&(strVec2.front()));
        swp4->setSample(&(strVec2.front()));
    }

    {
        A5::ReadArchive r;
        AbcA::ArchiveReaderPtr a = r( archiveName );
        AbcA::ObjectReaderPtr archive = a->getTop();

        AbcA::CompoundPropertyReaderPtr parent = archive->getProperties();
        TESTING_ASSERT(parent->getNumProperties() == 4);
        for (size_t i = 0; i < parent->getNumProperties(); ++i)
        {
            AbcA::BasePropertyReaderPtr bp = parent->getProperty( i );
            AbcA::ScalarPropertyReaderPtr sp = bp->asScalarPtr();
            switch (sp->getDataType().getPod())
            {
                case Alembic::Util::kUint16POD:
                {
                    TESTING_ASSERT( sp->getNumSamples() == 4 );

                    const AbcA::TimeSamplingPtr t = sp->getTimeSampling();
                    TESTING_ASSERT( sp->isConstant() );

                    Alembic::Util::uint16_t us;

                    for ( size_t i = 0; i < sp->getNumSamples(); ++i )
                    {
                        us = 0;
                        sp->getSample( 0, &us);
                        TESTING_ASSERT(us == 17);
                    }
                }
                break;

                case Alembic::Util::kFloat32POD:
                {
                    TESTING_ASSERT( sp->getNumSamples() == 6 );
                    TESTING_ASSERT( sp->getDataType().getExtent() == 1);
                    TESTING_ASSERT( !sp->isConstant() );

                    Alembic::Util::float32_t f = 0;

                    // make sure we can't get a non-existant sample
                    TESTING_ASSERT_THROW(sp->getSample( 100, &f ),
                        Alembic::Util::Exception);

                    sp->getSample( 5, &f );
                    TESTING_ASSERT(f == -3.0);

                    sp->getSample( 1, &f );
                    TESTING_ASSERT(f == 42.0);

                    sp->getSample( 4, &f );
                    TESTING_ASSERT(f == -3.0);

                    sp->getSample( 0, &f );
                    TESTING_ASSERT(f == 42.0);

                    sp->getSample( 3, &f );
                    TESTING_ASSERT(f == -3.0);

                    sp->getSample( 2, &f );
                    TESTING_ASSERT(f == 42.0);
                }
                break;

                case Alembic::Util::kInt32POD:
                {
                    TESTING_ASSERT( sp->getNumSamples() == 10 );
                    TESTING_ASSERT( sp->getDataType().getExtent() == 3);
                    TESTING_ASSERT( !sp->isConstant() );

                    std::vector< Alembic::Util::uint32_t > ui(3);

                    // lets explicitly test each sample
                    sp->getSample( 0, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                    sp->getSample( 1, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                    sp->getSample( 2, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 41 && ui[1] == 43 && ui[2] == 47);

                    sp->getSample( 3, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                    sp->getSample( 4, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 41 && ui[1] == 43 && ui[2] == 47);

                    sp->getSample( 5, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 41 && ui[1] == 43 && ui[2] == 47);

                    sp->getSample( 6, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 41 && ui[1] == 43 && ui[2] == 47);

                    sp->getSample( 7, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                    sp->getSample( 8, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                    sp->getSample( 9, &(ui.front()) );
                    TESTING_ASSERT(ui[0] == 0 && ui[1] == 1 && ui[2] == 2);

                }
                break;

                case Alembic::Util::kStringPOD:
                {
                    TESTING_ASSERT( sp->getNumSamples() == 4 );
                    TESTING_ASSERT( sp->getDataType().getExtent() == 3);
                    TESTING_ASSERT( !sp->isConstant() );

                    std::vector< Alembic::Util::string > val(3);
                    sp->getSample(0, &(val.front()));
                    TESTING_ASSERT( val[0] == "Please");
                    TESTING_ASSERT( val[1] == "");
                    TESTING_ASSERT( val[2] == "work");

                    sp->getSample(1, &(val.front()));
                    TESTING_ASSERT( val[0] == "Please");
                    TESTING_ASSERT( val[1] == "");
                    TESTING_ASSERT( val[2] == "work");

                    sp->getSample(2, &(val.front()));
                    TESTING_ASSERT( val[0] == "Whats");
                    TESTING_ASSERT( val[1] == "going");
                    TESTING_ASSERT( val[2] == "on?");

                    sp->getSample(3, &(val.front()));
                    TESTING_ASSERT( val[0] == "Whats");
                    TESTING_ASSERT( val[1] == "going");
                    TESTING_ASSERT( val[2] == "on?");
                }
                break;

                default:
                    TESTING_ASSERT(false);
                break;
            }
        } // for
    }
}
//-*****************************************************************************
void testObjects()
{
    std::string archiveName = "objectTest.abc";
    {
        A5::WriteArchive w;
        AbcA::ArchiveWriterPtr a = w(archiveName, AbcA::MetaData());
        AbcA::ObjectWriterPtr archive = a->getTop();
        TESTING_ASSERT(archive->getName() == "ABC");
        TESTING_ASSERT(archive->getFullName() == "/");

        AbcA::ObjectWriterPtr child1 = archive->createChild(
            AbcA::ObjectHeader("wow", AbcA::MetaData()));
        TESTING_ASSERT(child1->getName() == "wow");
        TESTING_ASSERT(child1->getFullName() == "/wow");

        AbcA::ObjectWriterPtr child2 = archive->createChild(
            AbcA::ObjectHeader("bar", AbcA::MetaData()));
        TESTING_ASSERT(child2->getName() == "bar");
        TESTING_ASSERT(child2->getFullName() == "/bar");

        AbcA::ObjectWriterPtr child3 = archive->createChild(
            AbcA::ObjectHeader("foo", AbcA::MetaData()));
        TESTING_ASSERT(child3->getName() == "foo");
        TESTING_ASSERT(child3->getFullName() == "/foo");

        TESTING_ASSERT(archive->getNumChildren() == 3);

        TESTING_ASSERT(child1->getNumChildren() == 0);
        AbcA::ObjectWriterPtr gchild = child1->createChild(
            AbcA::ObjectHeader("food", AbcA::MetaData()));
        TESTING_ASSERT(child1->getNumChildren() == 1);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "food");
        TESTING_ASSERT(gchild->getFullName() == "/wow/food");

        gchild = child2->createChild(
            AbcA::ObjectHeader("hat", AbcA::MetaData()));
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "hat");
        TESTING_ASSERT(gchild->getFullName() == "/bar/hat");
        TESTING_ASSERT_THROW(child2->createChild(
            AbcA::ObjectHeader("hat", AbcA::MetaData())),
            Alembic::Util::Exception);
        TESTING_ASSERT_THROW(child2->createChild(
            AbcA::ObjectHeader("slashy/", AbcA::MetaData())),
            Alembic::Util::Exception);
        TESTING_ASSERT_THROW(child2->createChild(
            AbcA::ObjectHeader("sla/shy", AbcA::MetaData())),
            Alembic::Util::Exception);
        TESTING_ASSERT_THROW(child2->createChild(
            AbcA::ObjectHeader("/slashy", AbcA::MetaData())),
            Alembic::Util::Exception);
        TESTING_ASSERT_THROW(child2->createChild(
            AbcA::ObjectHeader("", AbcA::MetaData())),
            Alembic::Util::Exception);
        gchild = child2->createChild(
            AbcA::ObjectHeader("bowling", AbcA::MetaData()));
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "bowling");
        TESTING_ASSERT(gchild->getFullName() == "/bar/bowling");
        TESTING_ASSERT(child2->getNumChildren() == 2);

        gchild = child3->createChild(
            AbcA::ObjectHeader("hamburger", AbcA::MetaData()));
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "hamburger");
        TESTING_ASSERT(gchild->getFullName() == "/foo/hamburger");

        gchild = child3->createChild(
            AbcA::ObjectHeader("burrito", AbcA::MetaData()));
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "burrito");
        TESTING_ASSERT(gchild->getFullName() == "/foo/burrito");

        gchild = child3->createChild(
            AbcA::ObjectHeader("pizza", AbcA::MetaData()));
        TESTING_ASSERT(child3->getNumChildren() == 3);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "pizza");
        TESTING_ASSERT(gchild->getFullName() == "/foo/pizza");
    }

    {
        A5::ReadArchive r;
        AbcA::ArchiveReaderPtr a = r( archiveName );
        AbcA::ObjectReaderPtr archive = a->getTop();
        TESTING_ASSERT(archive->getNumChildren() == 3);
        TESTING_ASSERT(archive->getName() == "ABC");
        TESTING_ASSERT(archive->getFullName() == "/");

        AbcA::ObjectReaderPtr child = archive->getChild(0);
        TESTING_ASSERT(child->getName() == "wow");
        TESTING_ASSERT(child->getFullName() == "/wow");
        TESTING_ASSERT(child->getNumChildren() == 1);
        AbcA::ObjectReaderPtr gchild = child->getChild(0);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "food");
        TESTING_ASSERT(gchild->getFullName() == "/wow/food");

        child = archive->getChild(1);
        TESTING_ASSERT(child->getName() == "bar");
        TESTING_ASSERT(child->getFullName() == "/bar");
        TESTING_ASSERT(child->getNumChildren() == 2);
        gchild = child->getChild(0);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "hat");
        TESTING_ASSERT(gchild->getFullName() == "/bar/hat");
        gchild = child->getChild(1);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "bowling");
        TESTING_ASSERT(gchild->getFullName() == "/bar/bowling");

        child = archive->getChild(2);
        TESTING_ASSERT(child->getName() == "foo");
        TESTING_ASSERT(child->getFullName() == "/foo");
        TESTING_ASSERT(child->getNumChildren() == 3);
        gchild = child->getChild(0);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "hamburger");
        TESTING_ASSERT(gchild->getFullName() == "/foo/hamburger");
        gchild = child->getChild(1);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getName() == "burrito");
        TESTING_ASSERT(gchild->getFullName() == "/foo/burrito");
        gchild = child->getChild(2);
        TESTING_ASSERT(gchild->getNumChildren() == 0);
        TESTING_ASSERT(gchild->getFullName() == "/foo/pizza");
        TESTING_ASSERT(gchild->getName() == "pizza");

        A5::ReadArchive r2;
        AbcA::ArchiveReaderPtr a2 = r2( archiveName );
        AbcA::ObjectReaderPtr archive2 = a2->getTop();
        AbcA::ObjectReaderPtr child2 = archive->getChild(0);
        AbcA::ObjectReaderPtr gchild2 = child2->getChild(0);
        TESTING_ASSERT(gchild2->getNumChildren() == 0);
        TESTING_ASSERT(gchild2->getName() == "food");
        TESTING_ASSERT(gchild2->getFullName() == "/wow/food");
    }
}