2016-04-13 23:39:22 +02:00
|
|
|
/** @file
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2014, Edouard DUPIN, all right reserved
|
2017-01-05 21:28:23 +01:00
|
|
|
* @license MPL v2.0 (see license file)
|
2016-04-13 23:39:22 +02:00
|
|
|
*/
|
|
|
|
|
2016-10-02 15:58:37 +02:00
|
|
|
#include <etk/types.hpp>
|
|
|
|
#include <test-debug/debug.hpp>
|
|
|
|
#include <exml/exml.hpp>
|
2017-09-07 23:38:26 +02:00
|
|
|
#include <etest/etest.hpp>
|
2016-04-13 23:39:22 +02:00
|
|
|
|
|
|
|
// _errorPos : -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
2017-08-28 00:05:54 +02:00
|
|
|
void exmlLocalTest(const etk::String& _ref,
|
|
|
|
const etk::String& _input,
|
2016-04-13 23:39:22 +02:00
|
|
|
int32_t _errorPos,
|
|
|
|
bool _caseInSensitive=false) {
|
|
|
|
exml::Document doc;
|
|
|
|
//doc.setCaseSensitive(!_caseInSensitive);
|
|
|
|
//EXML_DEBUG("parse : \n" << l_list[iii].m_input);
|
|
|
|
bool retParse = doc.parse(_input);
|
|
|
|
if (_errorPos == 1) {
|
|
|
|
EXPECT_EQ(retParse, false);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(retParse, true);
|
|
|
|
}
|
2017-08-28 00:05:54 +02:00
|
|
|
etk::String out("");
|
2016-04-13 23:39:22 +02:00
|
|
|
bool retGenerate = doc.generate(out);
|
|
|
|
if (_errorPos == 2) {
|
|
|
|
EXPECT_EQ(retGenerate, false);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(retGenerate, true);
|
|
|
|
}
|
|
|
|
if (_errorPos == 3) {
|
|
|
|
EXPECT_NE(_ref, out);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(_ref, out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|