1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-24 02:03:52 +03:00

feature #192: Tests for feature #282.

This commit is contained in:
Carlos Martín 2010-07-29 12:53:55 +02:00 committed by Ruben S. Montero
parent 35aa6ade2c
commit ab24a66e0e
2 changed files with 36 additions and 0 deletions

View File

@ -64,6 +64,9 @@ main_env.Append(CPPFLAGS=[
"-Wall"
])
# libxml2
main_env.ParseConfig('xml2-config --libs --cflags')
# MYSQL
main_env.Append(LIBPATH=["/usr/lib/mysql"])
main_env.Append(CPPPATH=["/usr/include/mysql"])

View File

@ -311,6 +311,35 @@ public:
CPPUNIT_ASSERT( n == 2 );
}
/* --------------------------------------------------------------------- */
void test_from_xml()
{
string str1;
string str2;
Template t_xml;
int rc;
// Generate a xml from a Template generated from a text template
t1->to_xml(str1);
CPPUNIT_ASSERT(test_ok_xml == str1);
// Parse the xml in a new Template object
rc = t_xml.from_xml(str1);
CPPUNIT_ASSERT(rc == 0);
// Check correct output of this xml-generated Template object
t_xml.to_xml(str2);
CPPUNIT_ASSERT(str1 == str2);
str1 = "";
str2 = "";
t1->to_str(str1);
t_xml.to_str(str2);
CPPUNIT_ASSERT(str1 == str2);
}
/* ********************************************************************* */
/* ********************************************************************* */
@ -351,6 +380,10 @@ public:
"erase() Test",
&TemplateTest::test_erase));
ts->addTest(new CppUnit::TestCaller<TemplateTest>(
"from_xml() Test",
&TemplateTest::test_from_xml));
return ts;
}
};