MOAB: Mesh Oriented datABase  (version 5.3.1)
ExtraDataTest Class Reference
+ Inheritance diagram for ExtraDataTest:
+ Collaboration diagram for ExtraDataTest:

Public Member Functions

void test_initialize ()
void test_finalize ()
void test_notify_destroyed ()
void test_notify_subpatch ()
void test_notify_new_patch_fill ()
void test_notify_new_patch_sub ()
void test_multiple_data ()

Private Member Functions

 CPPUNIT_TEST_SUITE (ExtraDataTest)
 CPPUNIT_TEST (test_initialize)
 CPPUNIT_TEST (test_finalize)
 CPPUNIT_TEST (test_notify_destroyed)
 CPPUNIT_TEST (test_notify_subpatch)
 CPPUNIT_TEST (test_notify_new_patch_fill)
 CPPUNIT_TEST (test_notify_new_patch_sub)
 CPPUNIT_TEST (test_multiple_data)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 41 of file ExtraDataTest.cpp.


Member Function Documentation

Definition at line 139 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT_EQUAL.

{
    PatchData patch;

    // PatchData doesn't expose any public method to
    // verify that the ExtraData object was removed when it
    // was destroyed!.  Do some funky stuff to be able to
    // call the ExtraData destructor w/out invalidating the
    // memory of the actual object.
    unsigned char* mem  = new unsigned char[sizeof( TestExtraData )];
    TestExtraData* data = new( mem ) TestExtraData( patch );
    data->~TestExtraData();
    CPPUNIT_ASSERT_EQUAL( data->get_patch_data(), (PatchData*)0 );
    delete[] mem;
}

Definition at line 128 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT_EQUAL, TestExtraData::get_last_event(), MBMesquite::ExtraData::get_patch_data(), and MBMesquite::NONE.

{
    PatchData patch;
    TestExtraData data1( patch );
    TestExtraData data2( patch );
    CPPUNIT_ASSERT_EQUAL( data1.get_patch_data(), &patch );
    CPPUNIT_ASSERT_EQUAL( data2.get_patch_data(), &patch );
    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::NONE );
    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::NONE );
}

Definition at line 240 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT_EQUAL, TestExtraData::DESTROYED, TestExtraData::get_last_event(), and MBMesquite::ExtraData::get_patch_data().

{
    PatchData* patch;
    TestExtraData *data1, *data2, *data3, *data4;

    patch = new PatchData;
    data1 = new TestExtraData( *patch );
    data2 = new TestExtraData( *patch );
    data3 = new TestExtraData( *patch );
    data4 = new TestExtraData( *patch );

    delete data2;
    delete data4;
    CPPUNIT_ASSERT_EQUAL( data1->get_patch_data(), patch );
    CPPUNIT_ASSERT_EQUAL( data3->get_patch_data(), patch );

    delete patch;
    CPPUNIT_ASSERT_EQUAL( data1->get_last_event(), TestExtraData::DESTROYED );
    CPPUNIT_ASSERT_EQUAL( data3->get_last_event(), TestExtraData::DESTROYED );
    CPPUNIT_ASSERT_EQUAL( data1->get_patch_data(), (PatchData*)0 );
    CPPUNIT_ASSERT_EQUAL( data3->get_patch_data(), (PatchData*)0 );

    delete data1;
    delete data3;
}

Definition at line 155 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT_EQUAL, TestExtraData::DESTROYED, TestExtraData::get_last_event(), and MBMesquite::ExtraData::get_patch_data().

{
    PatchData* patch = new PatchData;
    TestExtraData data1( *patch );
    TestExtraData data2( *patch );

    delete patch;
    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::DESTROYED );
    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::DESTROYED );
    CPPUNIT_ASSERT_EQUAL( data1.get_patch_data(), (PatchData*)0 );
    CPPUNIT_ASSERT_EQUAL( data2.get_patch_data(), (PatchData*)0 );
}

Definition at line 204 of file ExtraDataTest.cpp.

References TestExtraData::clear(), CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::create_four_quads_patch(), TestExtraData::get_last_event(), and TestExtraData::NEW.

{
    MsqPrintError err( std::cerr );
    PatchData patch;
    TestExtraData data1( patch );
    TestExtraData data2( patch );

    create_four_quads_patch( patch, err );
    CPPUNIT_ASSERT( !err );
    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::NEW );
    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::NEW );

    data1.clear();
    data2.clear();

    create_four_quads_patch( patch, err );
    CPPUNIT_ASSERT( !err );
    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::NEW );
    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::NEW );
}

Definition at line 225 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::create_four_quads_patch(), TestExtraData::get_last_event(), MBMesquite::PatchData::get_subpatch(), and TestExtraData::NEW.

{
    MsqPrintError err( std::cerr );
    PatchData patch, subpatch;
    TestExtraData data1( subpatch );
    TestExtraData data2( subpatch );

    create_four_quads_patch( patch, err );
    CPPUNIT_ASSERT( !err );
    patch.get_subpatch( 0, 1, subpatch, err );
    CPPUNIT_ASSERT( !err );
    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::NEW );
    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::NEW );
}

Definition at line 168 of file ExtraDataTest.cpp.

References CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::create_four_quads_patch(), TestExtraData::elementMap, MBMesquite::PatchData::get_element_handles_array(), TestExtraData::get_last_event(), MBMesquite::ExtraData::get_patch_data(), TestExtraData::get_sub_patch_ptr(), MBMesquite::PatchData::get_subpatch(), MBMesquite::PatchData::get_vertex_handles_array(), MBMesquite::PatchData::num_elements(), MBMesquite::PatchData::num_nodes(), TestExtraData::SUB, and TestExtraData::vertexMap.

{
    MsqPrintError err( std::cerr );
    PatchData patch, subpatch;
    create_four_quads_patch( patch, err );
    CPPUNIT_ASSERT( !err );

    TestExtraData data1( patch );
    TestExtraData data2( patch );
    patch.get_subpatch( 0, 1, subpatch, err );
    CPPUNIT_ASSERT( !err );

    CPPUNIT_ASSERT_EQUAL( data1.get_last_event(), TestExtraData::SUB );
    CPPUNIT_ASSERT_EQUAL( data1.get_sub_patch_ptr(), &subpatch );
    CPPUNIT_ASSERT_EQUAL( data1.get_patch_data(), &patch );

    size_t i;
    for( i = 0; i < subpatch.num_nodes(); ++i )
        CPPUNIT_ASSERT_EQUAL( subpatch.get_vertex_handles_array()[i],
                              patch.get_vertex_handles_array()[data1.vertexMap[i]] );
    for( i = 0; i < subpatch.num_elements(); ++i )
        CPPUNIT_ASSERT_EQUAL( subpatch.get_element_handles_array()[i],
                              patch.get_element_handles_array()[data1.elementMap[i]] );

    CPPUNIT_ASSERT_EQUAL( data2.get_last_event(), TestExtraData::SUB );
    CPPUNIT_ASSERT_EQUAL( data2.get_sub_patch_ptr(), &subpatch );
    CPPUNIT_ASSERT_EQUAL( data2.get_patch_data(), &patch );

    for( i = 0; i < subpatch.num_nodes(); ++i )
        CPPUNIT_ASSERT_EQUAL( subpatch.get_vertex_handles_array()[i],
                              patch.get_vertex_handles_array()[data2.vertexMap[i]] );
    for( i = 0; i < subpatch.num_elements(); ++i )
        CPPUNIT_ASSERT_EQUAL( subpatch.get_element_handles_array()[i],
                              patch.get_element_handles_array()[data2.elementMap[i]] );
}

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines