|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Include dependency graph for VarLenTagTest.cpp:Go to the source code of this file.
Classes | |
| class | GetOffsets |
| struct | ExpectedSize |
Defines | |
| #define | OFFSET(A) ( (char*)( &( A ) ) - (char*)this ) |
Functions | |
| void | test_valid_struct () |
| void | test_inline () |
| void | test_non_inline () |
| void | test_resize_ii () |
| void | test_resize_in () |
| void | test_resize_ni () |
| void | test_resize_nn () |
| int | main () |
| #define OFFSET | ( | A | ) | ( (char*)( &( A ) ) - (char*)this ) |
Definition at line 36 of file VarLenTagTest.cpp.
Referenced by GetOffsets::pointer_array_offset(), GetOffsets::pointer_size_offset(), and moab::ReadTemplate::read_elements().
| int main | ( | ) |
Definition at line 16 of file VarLenTagTest.cpp.
References RUN_TEST, test_inline(), test_non_inline(), test_resize_ii(), test_resize_in(), test_resize_ni(), test_resize_nn(), and test_valid_struct().
{
int count = 0;
count += RUN_TEST( test_valid_struct );
if( count )
{
std::cerr << "ABORTING VarLenTag TEST" << std::endl << "Structure is not valid" << std::endl;
return count;
}
count += RUN_TEST( test_inline );
count += RUN_TEST( test_non_inline );
count += RUN_TEST( test_resize_ii );
count += RUN_TEST( test_resize_in );
count += RUN_TEST( test_resize_ni );
count += RUN_TEST( test_resize_nn );
return count;
}
| void test_inline | ( | ) |
Definition at line 76 of file VarLenTagTest.cpp.
References CHECK_EQUAL, and moab::VarLenTag::data().
Referenced by main().
{
VarLenTag tag( sizeof( void* ) );
CHECK_EQUAL( (unsigned char*)&tag, tag.data() );
}
| void test_non_inline | ( | ) |
Definition at line 82 of file VarLenTagTest.cpp.
References CHECK, and moab::VarLenTag::data().
Referenced by main().
| void test_resize_ii | ( | ) |
Definition at line 88 of file VarLenTagTest.cpp.
References CHECK_EQUAL, moab::VarLenTag::data(), and moab::VarLenTag::resize().
Referenced by main().
{
VarLenTag tag( 1 );
tag.data()[0] = 'X';
unsigned char* ptr = tag.resize( 3 );
CHECK_EQUAL( tag.data(), ptr );
CHECK_EQUAL( (unsigned char*)&tag, tag.data() );
CHECK_EQUAL( tag.data()[0], 'X' );
}
| void test_resize_in | ( | ) |
Definition at line 98 of file VarLenTagTest.cpp.
References CHECK, CHECK_EQUAL, moab::VarLenTag::data(), and moab::VarLenTag::resize().
Referenced by main().
{
VarLenTag tag( sizeof( void* ) );
memcpy( tag.data(), "ABCDEFGHIJKLMNOPQRST", sizeof( void* ) );
unsigned char* ptr = tag.resize( 2 * sizeof( void* ) );
CHECK_EQUAL( tag.data(), ptr );
CHECK( (unsigned char*)&tag != tag.data() );
CHECK( !memcmp( tag.data(), "ABCDEFGHIJKLMNOPQRST", sizeof( void* ) ) );
}
| void test_resize_ni | ( | ) |
Definition at line 108 of file VarLenTagTest.cpp.
References CHECK, CHECK_EQUAL, moab::VarLenTag::data(), and moab::VarLenTag::resize().
Referenced by main().
{
VarLenTag tag( 2 * sizeof( void* ) );
memcpy( tag.data(), "12345678901234567890", sizeof( void* ) );
unsigned char* ptr = tag.resize( sizeof( void* ) );
CHECK_EQUAL( tag.data(), ptr );
CHECK_EQUAL( (unsigned char*)&tag, tag.data() );
CHECK( !memcmp( tag.data(), "12345678901234567890", sizeof( void* ) ) );
}
| void test_resize_nn | ( | ) |
Definition at line 118 of file VarLenTagTest.cpp.
References CHECK, CHECK_EQUAL, moab::VarLenTag::data(), and moab::VarLenTag::resize().
Referenced by main().
{
VarLenTag tag( 2 * sizeof( void* ) );
memcpy( tag.data(), "TSRQPONMLKJIHGFEDCBA", 2 * sizeof( void* ) );
unsigned char* ptr = tag.resize( 4 * sizeof( void* ) );
CHECK_EQUAL( tag.data(), ptr );
CHECK( (unsigned char*)&tag != tag.data() );
CHECK( !memcmp( tag.data(), "TSRQPONMLKJIHGFEDCBA", sizeof( void* ) ) );
}
| void test_valid_struct | ( | ) |
Definition at line 65 of file VarLenTagTest.cpp.
References CHECK_EQUAL, GetOffsets::pointer_array_offset(), and GetOffsets::pointer_size_offset().
Referenced by main().
{
GetOffsets off;
CHECK_EQUAL( 0u, off.pointer_array_offset() );
#ifdef VAR_LEN_TAG_ELIDE_DATA
CHECK_EQUAL( 0u, off.inline_array_offset() );
CHECK_EQUAL( off.pointer_size_offset(), off.inline_size_offset() );
#endif
CHECK_EQUAL( sizeof( ExpectedSize ), sizeof( VarLenTag ) );
}