mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #192: New test for Template::erase.
This commit is contained in:
parent
75cd62bc03
commit
5e23f178d3
@ -278,6 +278,40 @@ public:
|
||||
CPPUNIT_ASSERT(tr_xml == xml);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
void test_erase()
|
||||
{
|
||||
// There are Single and Vector type attributes, and any att. can be
|
||||
// unique within the template, or not.
|
||||
|
||||
int n;
|
||||
|
||||
// Non-existing attribute
|
||||
n = t1->erase("NON_EXISTING_ATT");
|
||||
CPPUNIT_ASSERT( n == 0 );
|
||||
|
||||
// CPU is a Unique & Single Att.
|
||||
n = t1->erase("CPU");
|
||||
CPPUNIT_ASSERT( n == 1 );
|
||||
|
||||
// GRAPHICS is a Unique & Vector Att.
|
||||
n = t1->erase("GRAPHICS");
|
||||
CPPUNIT_ASSERT( n == 1 );
|
||||
|
||||
// MEMORY is now a Multiple & Single Att.
|
||||
SingleAttribute* satt = new SingleAttribute("MEMORY", "123");
|
||||
t1->set(satt);
|
||||
|
||||
n = t1->erase("MEMORY");
|
||||
CPPUNIT_ASSERT( n == 2 );
|
||||
|
||||
// DISK is a Multiple & Vector Att.
|
||||
n = t1->erase("DISK");
|
||||
CPPUNIT_ASSERT( n == 2 );
|
||||
}
|
||||
|
||||
|
||||
/* ********************************************************************* */
|
||||
/* ********************************************************************* */
|
||||
|
||||
@ -312,6 +346,11 @@ public:
|
||||
ts->addTest(new CppUnit::TestCaller<TemplateTest>(
|
||||
"set() Test",
|
||||
&TemplateTest::test_set));
|
||||
|
||||
ts->addTest(new CppUnit::TestCaller<TemplateTest>(
|
||||
"erase() Test",
|
||||
&TemplateTest::test_erase));
|
||||
|
||||
return ts;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user