[DEV] correction of stl-port
This commit is contained in:
parent
d24b545ba9
commit
666605419c
@ -20,14 +20,14 @@ bool ejson::Number::iParse(const std::string& _data, int32_t& _pos, ejson::fileP
|
|||||||
for (int32_t iii=_pos; iii<_data.size(); iii++) {
|
for (int32_t iii=_pos; iii<_data.size(); iii++) {
|
||||||
_filePos.check(_data[iii]);
|
_filePos.check(_data[iii]);
|
||||||
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
|
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
|
||||||
drawElementParsed(_data[iii], _filePos);
|
drawElementParsed(_data[iii], _filePos);
|
||||||
#endif
|
#endif
|
||||||
if(true == checkNumber(_data[iii])) {
|
if(true == checkNumber(_data[iii])) {
|
||||||
tmpVal+=_data[iii];
|
tmpVal+=_data[iii];
|
||||||
} else {
|
} else {
|
||||||
_pos = iii-1;
|
_pos = iii-1;
|
||||||
m_value = std::stod(tmpVal);
|
m_value = std::stod(tmpVal);
|
||||||
JSON_PARSE_ELEMENT("end parse : 'Number' ");
|
JSON_PARSE_ELEMENT("end parse : 'Number' " << tmpVal << " >> " << m_value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,13 @@ bool ejson::Number::iParse(const std::string& _data, int32_t& _pos, ejson::fileP
|
|||||||
|
|
||||||
|
|
||||||
bool ejson::Number::iGenerate(std::string& _data, int32_t _indent) const {
|
bool ejson::Number::iGenerate(std::string& _data, int32_t _indent) const {
|
||||||
_data += m_value;
|
// special thing to remove .000000 at the end of perfect number ...
|
||||||
|
int64_t tmpVal = m_value;
|
||||||
|
if ((double)tmpVal == m_value) {
|
||||||
|
_data += std::to_string(tmpVal);
|
||||||
|
} else {
|
||||||
|
_data += std::to_string(m_value);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void init(void) {
|
|||||||
"{tmpElement:-956256}\n");
|
"{tmpElement:-956256}\n");
|
||||||
l_list.push_back(check);
|
l_list.push_back(check);
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
check.set("{\n\t\"tmpElement\": -956.256\n}\n",
|
check.set("{\n\t\"tmpElement\": -956.256000\n}\n",
|
||||||
-1,
|
-1,
|
||||||
"{tmpElement:-956.256}\n");
|
"{tmpElement:-956.256}\n");
|
||||||
l_list.push_back(check);
|
l_list.push_back(check);
|
||||||
@ -518,8 +518,8 @@ int main(int argc, const char *argv[]) {
|
|||||||
JSON_INFO("[TEST] " << sectionID << ":" << jjj << " { OK } Result in error (normal case)");
|
JSON_INFO("[TEST] " << sectionID << ":" << jjj << " { OK } Result in error (normal case)");
|
||||||
} else {
|
} else {
|
||||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR } different output");
|
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR } different output");
|
||||||
std::vector<std::string> tmpout = out.split('\n');
|
std::vector<std::string> tmpout = string_split(out, '\n');
|
||||||
std::vector<std::string> tmpref = l_list[iii].m_ref.split('\n');
|
std::vector<std::string> tmpref = string_split(l_list[iii].m_ref, '\n');
|
||||||
//JSON_ERROR("generate : \n" << out);
|
//JSON_ERROR("generate : \n" << out);
|
||||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||||
@ -538,8 +538,8 @@ int main(int argc, const char *argv[]) {
|
|||||||
}
|
}
|
||||||
if (l_list[iii].m_errorPos == 3) {
|
if (l_list[iii].m_errorPos == 3) {
|
||||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR} checking result might be in error...");
|
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR} checking result might be in error...");
|
||||||
std::vector<std::string> tmpout = out.split('\n');
|
std::vector<std::string> tmpout = string_split(out, '\n');
|
||||||
std::vector<std::string> tmpref = l_list[iii].m_ref.split('\n');
|
std::vector<std::string> tmpref = string_split(l_list[iii].m_ref, '\n');
|
||||||
//JSON_ERROR("generate : \n" << out);
|
//JSON_ERROR("generate : \n" << out);
|
||||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||||
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
for (int32_t jjj=0; jjj<tmpout.size() || jjj<tmpref.size(); ++jjj) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user