51 lines
No EOL
1 KiB
C++
51 lines
No EOL
1 KiB
C++
//
|
|
// Created by trotfunky on 07/05/19.
|
|
//
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "Circle.h"
|
|
#include "xmlParser.h"
|
|
|
|
TEST(readXML,initEmptyCircle)
|
|
{
|
|
xmlParser::Circle cercle;
|
|
cercle.initCirle();
|
|
|
|
ASSERT_EQ(cercle.x,0);
|
|
ASSERT_EQ(cercle.y,1);
|
|
ASSERT_EQ(cercle.r,2);
|
|
ASSERT_EQ(cercle.label,"Test circle");
|
|
}
|
|
|
|
TEST(readXML,initEmptyCirclePugiXML)
|
|
{
|
|
xmlParser::Circle cercle;
|
|
pugi::xml_node node;
|
|
cercle.initCircle(node);
|
|
|
|
ASSERT_EQ(cercle.x,0);
|
|
ASSERT_EQ(cercle.y,1);
|
|
ASSERT_EQ(cercle.r,2);
|
|
ASSERT_EQ(cercle.label,"Test circle");
|
|
}
|
|
|
|
TEST(readXML,parseXMLCircle)
|
|
{
|
|
std::string xml = "<?xml version = \"1.0\"?>\n"
|
|
"<Circle label=\"testCircle\" x=\"0\" y=\"1\" r=\"2\" color=\"Black\"/>";
|
|
|
|
pugi::xml_document doc;
|
|
pugi::xml_parse_result result = doc.load_string(xml.c_str());
|
|
EXPECT_NE(0,result);
|
|
|
|
xmlParser::Circle cercle;
|
|
|
|
cercle.initCircle(doc.child("Circle"));
|
|
}
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
::testing::InitGoogleTest(&argc,argv);
|
|
return RUN_ALL_TESTS();
|
|
} |