mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Added tests to basic CValue functionality
This commit is contained in:
@ -318,6 +318,9 @@ namespace NSJSON
|
||||
CValue CValue::CreateArray(int count)
|
||||
{
|
||||
CValue ret;
|
||||
if (count < 0)
|
||||
return ret;
|
||||
|
||||
ret.m_internal->m_value = std::make_shared<CArray>(count);
|
||||
ret.m_internal->m_type = CTypedValue::vtArray;
|
||||
return ret;
|
||||
@ -326,6 +329,9 @@ namespace NSJSON
|
||||
CValue CValue::CreateTypedArray(BYTE* data, int count, bool isExternalize)
|
||||
{
|
||||
CValue ret;
|
||||
if (count <= 0)
|
||||
return ret;
|
||||
|
||||
ret.m_internal->m_value = std::make_shared<CTypedArray>(data, count, isExternalize);
|
||||
ret.m_internal->m_type = CTypedValue::vtTypedArray;
|
||||
return ret;
|
||||
|
||||
@ -125,7 +125,7 @@ namespace NSJSON
|
||||
if (m_type == ptDouble)
|
||||
return m_double;
|
||||
if (m_type == ptInteger)
|
||||
return (double)m_double;
|
||||
return (double)m_int;
|
||||
#ifdef JSON_DEBUG
|
||||
throw std::bad_cast();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user