2019-05-07 13:07:58 +02:00
|
|
|
//
|
|
|
|
// Created by trotfunky on 07/05/19.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "Circle.h"
|
|
|
|
#include "xmlParser.h"
|
|
|
|
|
|
|
|
TEST(readXML,initEmptyCircle)
|
|
|
|
{
|
2019-05-14 13:07:25 +02:00
|
|
|
xmlParser::Circle cercle = xmlParser::Circle();
|
2019-05-07 13:07:58 +02:00
|
|
|
|
|
|
|
ASSERT_EQ(cercle.x,0);
|
|
|
|
ASSERT_EQ(cercle.y,1);
|
|
|
|
ASSERT_EQ(cercle.r,2);
|
|
|
|
ASSERT_EQ(cercle.label,"Test circle");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(readXML,initEmptyCirclePugiXML)
|
|
|
|
{
|
2019-05-14 13:07:25 +02:00
|
|
|
xmlParser::Circle cercle = xmlParser::Circle();
|
2019-05-07 13:07:58 +02:00
|
|
|
pugi::xml_node 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);
|
|
|
|
|
2019-05-14 13:07:25 +02:00
|
|
|
pugi::xml_node node = doc.child("Circle");
|
|
|
|
xmlParser::Circle cercle = xmlParser::Circle(node);
|
2019-05-07 13:07:58 +02:00
|
|
|
|
2019-05-14 13:07:25 +02:00
|
|
|
ASSERT_EQ(cercle.x,0);
|
|
|
|
ASSERT_EQ(cercle.y,1);
|
|
|
|
ASSERT_EQ(cercle.r,2);
|
|
|
|
ASSERT_EQ(cercle.label,"testCircle");
|
2019-05-07 13:07:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
::testing::InitGoogleTest(&argc,argv);
|
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
}
|