Unit tests for ParamList to json.
This commit is contained in:
parent
e9f5fff6d3
commit
dec52a3829
5 changed files with 72 additions and 11 deletions
|
|
@ -1,10 +1,9 @@
|
|||
#include "ParamListJson.h"
|
||||
#include "ParamListModel.h"
|
||||
|
||||
Json::Value ParamToJson(const Param ¶m)
|
||||
{
|
||||
Json::Value v;
|
||||
v["type"] = (int)param.type.toUtf8().data();
|
||||
v["type"] = param.type.toUtf8().data();
|
||||
v["value"] = param.value.toUtf8().data();
|
||||
return v;
|
||||
}
|
||||
|
|
@ -16,7 +15,7 @@ Param ParamFromJson(const Json::Value &json)
|
|||
return p;
|
||||
}
|
||||
|
||||
Json::Value ParamListModelToJson(const t_ParamList &list)
|
||||
Json::Value ParamListToJson(const t_ParamList &list)
|
||||
{
|
||||
Json::Value root;
|
||||
for (const auto ¶m : list) {
|
||||
|
|
@ -25,7 +24,7 @@ Json::Value ParamListModelToJson(const t_ParamList &list)
|
|||
return root;
|
||||
}
|
||||
|
||||
t_ParamList ParamListModelFromJson(const Json::Value &json)
|
||||
t_ParamList ParamListFromJson(const Json::Value &json)
|
||||
{
|
||||
t_ParamList result;
|
||||
if (json.isArray()) {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
#define PARAMLISTJSON_H
|
||||
|
||||
#include "json/json.h"
|
||||
#include "ParamListModel.h"
|
||||
|
||||
class ParamListModel;
|
||||
|
||||
Json::Value ParamListModelToJson(const t_ParamList &list);
|
||||
Json::Value ParamListToJson(const t_ParamList &list);
|
||||
|
||||
#endif // PARAMLISTJSON_H
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ TARGET = core
|
|||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++14
|
||||
|
||||
INCLUDEPATH += C:\prog\include C:\VSproj\boost32\include\boost-1_65_1
|
||||
INCLUDEPATH += C:\prog\include \
|
||||
C:\Prog\include\pgsql \
|
||||
C:\VSproj\boost32\include\boost-1_65_1
|
||||
|
||||
DEFINES += WIN32_LEAN_AND_MEAN NOMINMAX
|
||||
#LIBS += /LIBPATH:C:\VSproj\boost_1_63_0\stage\lib /LIBPATH:c:\prog\lib\ libpq.lib fmt.lib User32.lib ws2_32.lib
|
||||
|
||||
|
|
@ -46,7 +49,8 @@ HEADERS += PasswordManager.h \
|
|||
Expected.h \
|
||||
ExplainTreeModelItem.h \
|
||||
ParamListJson.h \
|
||||
ParamListModel.h
|
||||
ParamListModel.h \
|
||||
json/json.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
|
|
@ -54,3 +58,16 @@ unix {
|
|||
}
|
||||
|
||||
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../pgsql/release/ -lpgsql
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../pgsql/debug/ -lpgsql
|
||||
else:unix:!macx: LIBS += -L$$OUT_PWD/../pgsql/ -lpgsql
|
||||
|
||||
INCLUDEPATH += $$PWD/../pgsql
|
||||
DEPENDPATH += $$PWD/../pgsql
|
||||
|
||||
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/libpgsql.a
|
||||
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/libpgsql.a
|
||||
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/pgsql.lib
|
||||
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/pgsql.lib
|
||||
else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../pgsql/libpgsql.a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue