|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <iostream>#include "moab/Interface.hpp"#include "Internals.hpp"#include "moab/ReadUtilIface.hpp"#include "moab/Core.hpp"#include "moab/Range.hpp"
Include dependency graph for readutil_test.cpp:Go to the source code of this file.
Defines | |
| #define | IS_BUILDING_MB |
| #define | CHKERR(A) |
| #define | RUN_TEST(A) _run_test( ( A ), #A ) |
Typedefs | |
| typedef ErrorCode(* | TestFunc )() |
Functions | |
| ErrorCode | gather_related_test () |
| static void | _run_test (TestFunc func, const char *func_str) |
| int | main (int, char **) |
Variables | |
| int | number_tests = 0 |
| int | number_tests_failed = 0 |
| #define CHKERR | ( | A | ) |
do \ { \ if( MB_SUCCESS != ( A ) ) \ { \ std::cerr << "Failure (error code " << ( A ) << ") at " __FILE__ ":" << __LINE__ << std::endl; \ return A; \ } \ } while( false )
Definition at line 13 of file readutil_test.cpp.
Referenced by gather_related_test().
| #define IS_BUILDING_MB |
Definition at line 4 of file readutil_test.cpp.
Definition at line 63 of file readutil_test.cpp.
Referenced by main().
Definition at line 65 of file readutil_test.cpp.
Definition at line 66 of file readutil_test.cpp.
References moab::error(), ErrorCode, moab::Core::get_error_string(), MB_SUCCESS, number_tests, and number_tests_failed.
{
++number_tests;
std::cout << " " << func_str << ": ";
std::cout.flush();
ErrorCode error = func();
if( MB_SUCCESS == error )
std::cout << "Success" << std::endl;
else if( MB_FAILURE == error )
std::cout << "Failure" << std::endl;
else
{
Core moab;
std::cout << "Failed: " << moab.get_error_string( error ) << std::endl;
}
if( MB_SUCCESS != error )
{
++number_tests_failed;
}
}
Definition at line 23 of file readutil_test.cpp.
References moab::Core::add_parent_child(), moab::Range::begin(), CHKERR, moab::Core::create_meshset(), moab::E, ErrorCode, moab::ReadUtilIface::gather_related_ents(), moab::Range::insert(), mb, MB_SUCCESS, MESHSET_SET, and moab::Range::size().
Referenced by main().
{
// create an entityset structure and test related entities function
// sets: A
// |
// B C
// |/ |
// D E
// if D is passed in to gather_related_ents, A-D should be returned, and E should not be
//
EntityHandle A, B, C, D, E;
Core mb;
ErrorCode rval = mb.create_meshset( MESHSET_SET, A );CHKERR( rval );
rval = mb.create_meshset( MESHSET_SET, B );CHKERR( rval );
rval = mb.create_meshset( MESHSET_SET, C );CHKERR( rval );
rval = mb.create_meshset( MESHSET_SET, D );CHKERR( rval );
rval = mb.create_meshset( MESHSET_SET, E );CHKERR( rval );
rval = mb.add_parent_child( A, B );CHKERR( rval );
rval = mb.add_parent_child( B, D );CHKERR( rval );
rval = mb.add_parent_child( C, D );CHKERR( rval );
rval = mb.add_parent_child( C, E );CHKERR( rval );
// now test it
ReadUtilIface* readMeshIface;
mb.Interface::query_interface( readMeshIface );
Range init_range, set_range, all_sets( A, E );
init_range.insert( D );
rval = readMeshIface->gather_related_ents( init_range, set_range );CHKERR( rval );
if( set_range.size() != 4 ) return MB_FAILURE;
all_sets -= set_range;
if( 1 != all_sets.size() || *all_sets.begin() != E ) return MB_FAILURE;
return MB_SUCCESS;
}
| int main | ( | int | , |
| char ** | |||
| ) |
Definition at line 89 of file readutil_test.cpp.
References gather_related_test(), number_tests, number_tests_failed, and RUN_TEST.
{
RUN_TEST( gather_related_test );
std::cout << "\nMB TEST SUMMARY: \n"
<< " Number Tests: " << number_tests << "\n"
<< " Number Successful: " << number_tests - number_tests_failed << "\n"
<< " Number Failed: " << number_tests_failed << "\n\n";
return number_tests_failed;
}
| int number_tests = 0 |
Definition at line 61 of file readutil_test.cpp.
Referenced by _run_test(), and main().
| int number_tests_failed = 0 |
Definition at line 62 of file readutil_test.cpp.