14 #define handle_test_assert( C ) \
15 if( internal_assert( C ) ) \
17 cout << "Test: " #C " failed ." << endl; \
37 int proc_from_handle =
handleUtils.rank_from_handle( handle );
43 #define tag_test_assert( C ) \
44 if( internal_assert( C ) ) \
46 cout << "Test: " #C " failed." << endl; \
52 Tag tag = TAG_HANDLE_FROM_ID(
id, prop );
54 unsigned long id_from_handle = ID_FROM_TAG_HANDLE( tag );
57 TagType prop_from_handle = PROP_FROM_TAG_HANDLE( tag );
66 const unsigned cpus[] = { 1, 4, 16, 5, 20 };
67 const int num_cpus =
sizeof( cpus ) /
sizeof( cpus[0] );
68 unsigned errors = 0, tests = 0;
69 const int num_prop = MB_TAG_LAST + 1;
72 if( MB_TAG_LAST > num_prop )
74 cout <<
"MB_TAG_PROP_WIDTH insufficient for size of TagType" << endl;
81 cout <<
"MB_TYPE_WIDTH insufficient for size of EntityType" << endl;
87 if( errors )
return errors;
89 for(
int num_cpu = 0; num_cpu < num_cpus; ++num_cpu )
96 const TagId tids[] = { 0, 1, MB_TAG_PROP_MASK / 2, MB_TAG_PROP_MASK - 1, MB_TAG_PROP_MASK };
97 const int num_ids =
sizeof( ids ) /
sizeof( ids[0] );
98 const int num_tids =
sizeof( tids ) /
sizeof( tids[0] );
100 for(
unsigned cpu = 0; cpu < cpus[num_cpu]; ++cpu )
103 for(
int id = 0;
id < num_ids; ++id )
108 cout <<
"Test of handle with type=" << type <<
", id=" << ids[id] <<
", proc=" << cpu
109 <<
", and numproc=" << cpus[num_cpu] << endl;
114 for(
int prop = 0; prop < num_prop; ++prop )
115 for(
int id = 0;
id < num_tids; ++id )
120 cout <<
"Test of tag handle with prop=" << prop <<
", id=" << tids[id] <<
", proc=" << cpu
121 <<
", and numproc=" << cpus[num_cpu] << endl;
133 cout <<
"Failed to catch ID overflow" << endl;
139 cout <<
"Failed to catch type overflow" << endl;
149 cout << endl << errors <<
" of " << tests <<
" tests failed." << endl << endl;
151 cout << endl << tests <<
" tests passed." << endl << endl;