[DEBUG] update to the new interface etk
This commit is contained in:
parent
830d651907
commit
b91410fef3
@ -220,7 +220,7 @@ bool ejson::internal::Object::iGenerate(etk::String& _data, size_t _indent) cons
|
||||
oneLine = false;
|
||||
} else {
|
||||
for (int32_t iii=0; iii<m_value.size() ; iii++) {
|
||||
const ememory::SharedPtr<ejson::internal::Value> tmp = m_value[iii];
|
||||
const ememory::SharedPtr<ejson::internal::Value> tmp = m_value.getValue(iii);
|
||||
if (tmp == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
@ -29,7 +29,13 @@ def get_maintainer():
|
||||
|
||||
def configure(target, my_module):
|
||||
my_module.add_src_file([
|
||||
'test/test.cpp'
|
||||
'test/test.cpp',
|
||||
'test/testCommon.cpp',
|
||||
'test/testDocument.cpp',
|
||||
'test/testBoolean.cpp',
|
||||
'test/testNull.cpp',
|
||||
'test/testNumber.cpp',
|
||||
'test/testAll.cpp',
|
||||
])
|
||||
my_module.add_depend([
|
||||
'ejson',
|
||||
|
@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
@ -15,11 +13,6 @@
|
||||
#include <etest/etest.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
|
||||
#include "testDocument.hpp"
|
||||
#include "testBoolean.hpp"
|
||||
#include "testNull.hpp"
|
||||
#include "testNumber.hpp"
|
||||
#include "testAll.hpp"
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
// init test engine:
|
||||
|
@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <etest/etest.hpp>
|
@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <etest/etest.hpp>
|
54
test/testCommon.cpp
Normal file
54
test/testCommon.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
#include <etest/etest.hpp>
|
||||
|
||||
// _errorPos : -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
||||
void localTest(const etk::String& _ref, const etk::String& _input, int32_t _errorPos) {
|
||||
ejson::Document doc;
|
||||
bool retParse = doc.parse(_input);
|
||||
if (_errorPos == 1) {
|
||||
EXPECT_EQ(retParse, false);
|
||||
return;
|
||||
} else {
|
||||
EXPECT_EQ(retParse, true);
|
||||
}
|
||||
etk::String out("");
|
||||
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);
|
||||
/*
|
||||
JSON_ERROR("[TEST] {ERROR } different output");
|
||||
etk::Vector<etk::String> tmpout = etk::split(out, '\n');
|
||||
etk::Vector<etk::String> tmpref = etk::split(_ref, '\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||
if (jjj<tmpref.size()) {
|
||||
TEST_INFO("[" << jjj << "] " << tmpref[jjj] );
|
||||
}
|
||||
if (jjj<tmpout.size()) {
|
||||
if (jjj>=tmpref.size() || tmpref[jjj] != tmpout[jjj]) {
|
||||
TEST_ERROR("[" << jjj << "] " << tmpout[jjj] );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +1,10 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
|
||||
// _errorPos : -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
||||
static void localTest(const etk::String& _ref, const etk::String& _input, int32_t _errorPos) {
|
||||
ejson::Document doc;
|
||||
bool retParse = doc.parse(_input);
|
||||
if (_errorPos == 1) {
|
||||
EXPECT_EQ(retParse, false);
|
||||
return;
|
||||
} else {
|
||||
EXPECT_EQ(retParse, true);
|
||||
}
|
||||
etk::String out("");
|
||||
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);
|
||||
/*
|
||||
JSON_ERROR("[TEST] {ERROR } different output");
|
||||
etk::Vector<etk::String> tmpout = etk::split(out, '\n');
|
||||
etk::Vector<etk::String> tmpref = etk::split(_ref, '\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||
if (jjj<tmpref.size()) {
|
||||
TEST_INFO("[" << jjj << "] " << tmpref[jjj] );
|
||||
}
|
||||
if (jjj<tmpout.size()) {
|
||||
if (jjj>=tmpref.size() || tmpref[jjj] != tmpout[jjj]) {
|
||||
TEST_ERROR("[" << jjj << "] " << tmpout[jjj] );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
void localTest(const etk::String& _ref, const etk::String& _input, int32_t _errorPos);
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <etest/etest.hpp>
|
@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <etest/etest.hpp>
|
@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "testCommon.hpp"
|
||||
#include <etest/etest.hpp>
|
Loading…
Reference in New Issue
Block a user