Add demonstration of getting units from MemoryManager::ref_attributes(). Fixes

This commit is contained in:
John M. Penn 2015-09-30 17:30:51 -05:00
parent 757f0764f6
commit fcb419d534
2 changed files with 10 additions and 1 deletions
trick_source/sim_services/MemoryManager/test

View File

@ -78,6 +78,11 @@ TEST_F(MM_ref_attributes, NormalCases) {
ref = memmgr->ref_attributes("udt3.M2");
ASSERT_TRUE(ref != NULL);
EXPECT_EQ( &udt3.M2, ref->address);
ASSERT_TRUE(ref->attr != NULL);
ASSERT_TRUE(ref->attr->units != NULL);
std::cout << "Units of udt3.M2 = " << ref->attr->units << std::endl;
free( ref);
std::cout << "Case of: \"udt3.M2[2][3]\"" << std::endl;
@ -90,6 +95,10 @@ TEST_F(MM_ref_attributes, NormalCases) {
ref = memmgr->ref_attributes("udt3.M3[1][1][3]");
ASSERT_TRUE(ref != NULL);
EXPECT_EQ( &udt3.M3[1][1][3], ref->address);
ASSERT_TRUE(ref->attr != NULL);
ASSERT_TRUE(ref->attr->units != NULL);
std::cout << "Units of udt3.M3 = " << ref->attr->units << std::endl;
free( ref);
std::cout << "Case of: \"udt3.C[5]\"" << std::endl;

View File

@ -72,7 +72,7 @@ class UDT3 {
double Z;
int I;
double M2[3][4]; /* r */
double M3[2][3][4]; /* r */
double M3[2][3][4]; /* d */
char C[10];
UDT2 N;
UDT2 NA[2];