forked from loafle/openapi-generator-original
[cpp][tiny] rename generator, update samples (#9560)
* rename generator, update samples * add doc * update readme
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
|
||||
#include "ApiResponse.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_ApiResponse_code_is_assigned_from_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"code", 1
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getCode());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_ApiResponse_type_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"type", "hello"
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getType().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_ApiResponse_message_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"message", "hello"
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getMessage().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_ApiResponse_code_is_converted_to_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"code", 1
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["code"] == output["code"]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_ApiResponse_type_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"type", "hello"
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["type"] == output["type"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_ApiResponse_message_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"message", "hello"
|
||||
};
|
||||
|
||||
ApiResponse obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["message"] == output["message"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
|
||||
#include "Category.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_Category_id_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Category obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Category_name_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Category obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getName().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Category_id_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Category obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["id"] == output["id"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Category_name_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Category obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["name"] == output["name"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
245
samples/client/petstore/cpp-tiny/lib/TestFiles/OrderTest.cpp
Normal file
245
samples/client/petstore/cpp-tiny/lib/TestFiles/OrderTest.cpp
Normal file
@@ -0,0 +1,245 @@
|
||||
|
||||
#include "Order.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_Order_id_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_petId_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"petId", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getPetId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_quantity_is_assigned_from_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"quantity", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getQuantity());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_shipDate_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_status_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"status", "hello"
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getStatus().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_complete_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"complete", true
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
TEST_ASSERT(true == obj.isComplete());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Order_id_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["id"] == output["id"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_petId_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"petId", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["petId"] == output["petId"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_quantity_is_converted_to_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"quantity", 1
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["quantity"] == output["quantity"]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_shipDate_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_status_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"status", "hello"
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["status"] == output["status"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Order_complete_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"complete", true
|
||||
};
|
||||
|
||||
Order obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["complete"] == output["complete"]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
145
samples/client/petstore/cpp-tiny/lib/TestFiles/PetTest.cpp
Normal file
145
samples/client/petstore/cpp-tiny/lib/TestFiles/PetTest.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
|
||||
#include "Pet.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_Pet_id_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Pet_name_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getName().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void test_Pet_status_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"status", "hello"
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getStatus().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Pet_id_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["id"] == output["id"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Pet_name_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["name"] == output["name"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void test_Pet_status_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"status", "hello"
|
||||
};
|
||||
|
||||
Pet obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["status"] == output["status"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
97
samples/client/petstore/cpp-tiny/lib/TestFiles/TagTest.cpp
Normal file
97
samples/client/petstore/cpp-tiny/lib/TestFiles/TagTest.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
#include "Tag.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_Tag_id_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Tag obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Tag_name_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Tag obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getName().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_Tag_id_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
Tag obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["id"] == output["id"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_Tag_name_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"name", "hello"
|
||||
};
|
||||
|
||||
Tag obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["name"] == output["name"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
349
samples/client/petstore/cpp-tiny/lib/TestFiles/UserTest.cpp
Normal file
349
samples/client/petstore/cpp-tiny/lib/TestFiles/UserTest.cpp
Normal file
@@ -0,0 +1,349 @@
|
||||
|
||||
#include "User.h"
|
||||
|
||||
using namespace Tiny;
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unity.h>
|
||||
#include "bourne/json.hpp"
|
||||
|
||||
|
||||
|
||||
void test_User_id_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_username_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"username", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getUsername().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_firstName_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"firstName", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getFirstName().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_lastName_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"lastName", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getLastName().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_email_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"email", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getEmail().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_password_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"password", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getPassword().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_phone_is_assigned_from_json()
|
||||
{
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"phone", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING("hello", obj.getPhone().c_str());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_userStatus_is_assigned_from_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"userStatus", 1
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1, obj.getUserStatus());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_User_id_is_converted_to_json()
|
||||
{
|
||||
|
||||
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"id", 1
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["id"] == output["id"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_username_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"username", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["username"] == output["username"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_firstName_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"firstName", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["firstName"] == output["firstName"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_lastName_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"lastName", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["lastName"] == output["lastName"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_email_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"email", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["email"] == output["email"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_password_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"password", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["password"] == output["password"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_phone_is_converted_to_json()
|
||||
{
|
||||
|
||||
bourne::json input =
|
||||
{
|
||||
"phone", "hello"
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["phone"] == output["phone"]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_User_userStatus_is_converted_to_json()
|
||||
{
|
||||
bourne::json input =
|
||||
{
|
||||
"userStatus", 1
|
||||
};
|
||||
|
||||
User obj(input.dump());
|
||||
|
||||
bourne::json output = bourne::json::object();
|
||||
|
||||
output = obj.toJson();
|
||||
|
||||
TEST_ASSERT(input["userStatus"] == output["userStatus"]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user