mirror of
https://github.com/oatpp/oatpp.git
synced 2025-03-31 18:30:22 +08:00
Rename confusing-type-like field names in tests.
This commit is contained in:
parent
713148f99e
commit
1207254616
@ -39,23 +39,23 @@ namespace {
|
||||
|
||||
DTO_INIT(TestDto, DTO);
|
||||
|
||||
DTO_FIELD(String, f_string);
|
||||
DTO_FIELD(Int8, f_int8);
|
||||
DTO_FIELD(Int16, f_int16);
|
||||
DTO_FIELD(Int32, f_int32);
|
||||
DTO_FIELD(Int64, f_int64);
|
||||
DTO_FIELD(Float32, f_float32);
|
||||
DTO_FIELD(Float64, f_float64);
|
||||
DTO_FIELD(Boolean, f_boolean);
|
||||
DTO_FIELD(String, field_string);
|
||||
DTO_FIELD(Int8, field_int8);
|
||||
DTO_FIELD(Int16, field_int16);
|
||||
DTO_FIELD(Int32, field_int32);
|
||||
DTO_FIELD(Int64, field_int64);
|
||||
DTO_FIELD(Float32, field_float32);
|
||||
DTO_FIELD(Float64, field_float64);
|
||||
DTO_FIELD(Boolean, field_boolean);
|
||||
|
||||
DTO_FIELD(List<String>::ObjectWrapper, f_list_string);
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, f_list_int32);
|
||||
DTO_FIELD(List<Int64>::ObjectWrapper, f_list_int64);
|
||||
DTO_FIELD(List<Float32>::ObjectWrapper, f_list_float32);
|
||||
DTO_FIELD(List<Float64>::ObjectWrapper, f_list_float64);
|
||||
DTO_FIELD(List<Boolean>::ObjectWrapper, f_list_boolean);
|
||||
DTO_FIELD(List<String>::ObjectWrapper, field_list_string);
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, field_list_int32);
|
||||
DTO_FIELD(List<Int64>::ObjectWrapper, field_list_int64);
|
||||
DTO_FIELD(List<Float32>::ObjectWrapper, field_list_float32);
|
||||
DTO_FIELD(List<Float64>::ObjectWrapper, field_list_float64);
|
||||
DTO_FIELD(List<Boolean>::ObjectWrapper, field_list_boolean);
|
||||
|
||||
DTO_FIELD(Fields<String>::ObjectWrapper, f_map_string_string);
|
||||
DTO_FIELD(Fields<String>::ObjectWrapper, field_map_string_string);
|
||||
|
||||
DTO_FIELD(TestDto::ObjectWrapper, obj1);
|
||||
|
||||
@ -69,50 +69,50 @@ void TypeTest::onRun() {
|
||||
|
||||
auto obj = TestDto::createShared();
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_string.valueType->name);
|
||||
OATPP_ASSERT(obj->f_string.valueType->name == oatpp::data::mapping::type::__class::String::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_string.valueType->name);
|
||||
OATPP_ASSERT(obj->field_string.valueType->name == oatpp::data::mapping::type::__class::String::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_int8.valueType->name);
|
||||
OATPP_ASSERT(obj->f_int8.valueType->name == oatpp::data::mapping::type::__class::Int8::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int8.valueType->name);
|
||||
OATPP_ASSERT(obj->field_int8.valueType->name == oatpp::data::mapping::type::__class::Int8::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_int16.valueType->name);
|
||||
OATPP_ASSERT(obj->f_int16.valueType->name == oatpp::data::mapping::type::__class::Int16::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int16.valueType->name);
|
||||
OATPP_ASSERT(obj->field_int16.valueType->name == oatpp::data::mapping::type::__class::Int16::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_int32.valueType->name);
|
||||
OATPP_ASSERT(obj->f_int32.valueType->name == oatpp::data::mapping::type::__class::Int32::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int32.valueType->name);
|
||||
OATPP_ASSERT(obj->field_int32.valueType->name == oatpp::data::mapping::type::__class::Int32::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_int64.valueType->name);
|
||||
OATPP_ASSERT(obj->f_int64.valueType->name == oatpp::data::mapping::type::__class::Int64::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_int64.valueType->name);
|
||||
OATPP_ASSERT(obj->field_int64.valueType->name == oatpp::data::mapping::type::__class::Int64::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_float32.valueType->name);
|
||||
OATPP_ASSERT(obj->f_float32.valueType->name == oatpp::data::mapping::type::__class::Float32::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float32.valueType->name);
|
||||
OATPP_ASSERT(obj->field_float32.valueType->name == oatpp::data::mapping::type::__class::Float32::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_float64.valueType->name);
|
||||
OATPP_ASSERT(obj->f_float64.valueType->name == oatpp::data::mapping::type::__class::Float64::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_float64.valueType->name);
|
||||
OATPP_ASSERT(obj->field_float64.valueType->name == oatpp::data::mapping::type::__class::Float64::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_boolean.valueType->name);
|
||||
OATPP_ASSERT(obj->f_boolean.valueType->name == oatpp::data::mapping::type::__class::Boolean::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_boolean.valueType->name);
|
||||
OATPP_ASSERT(obj->field_boolean.valueType->name == oatpp::data::mapping::type::__class::Boolean::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_string.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_string.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_string.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_string.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_int32.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_int32.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int32.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_int32.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_int64.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_int64.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_int64.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_int64.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_float32.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_float32.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float32.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_float32.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_float64.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_float64.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_float64.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_float64.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_list_boolean.valueType->name);
|
||||
OATPP_ASSERT(obj->f_list_boolean.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_list_boolean.valueType->name);
|
||||
OATPP_ASSERT(obj->field_list_boolean.valueType->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->f_map_string_string.valueType->name);
|
||||
OATPP_ASSERT(obj->f_map_string_string.valueType->name == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_NAME);
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->field_map_string_string.valueType->name);
|
||||
OATPP_ASSERT(obj->field_map_string_string.valueType->name == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_NAME);
|
||||
|
||||
OATPP_LOGV(TAG, "type: '%s'", obj->obj1.valueType->name);
|
||||
OATPP_ASSERT(obj->obj1.valueType->name == oatpp::data::mapping::type::__class::AbstractObject::CLASS_NAME);
|
||||
|
@ -44,18 +44,18 @@ typedef oatpp::parser::json::mapping::Deserializer Deserializer;
|
||||
|
||||
DTO_INIT(Test1, Object)
|
||||
|
||||
DTO_FIELD(String, f_string);
|
||||
DTO_FIELD(Int32, f_int32);
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, f_list);
|
||||
DTO_FIELD(String, field_string);
|
||||
DTO_FIELD(Int32, field_int32);
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, field_list);
|
||||
|
||||
static ObjectWrapper createTestInstance(){
|
||||
auto result = Test1::createShared();
|
||||
result->f_string = "String Field";
|
||||
result->f_int32 = 5;
|
||||
result->f_list = List<Int32>::createShared();
|
||||
result->f_list->pushBack(1);
|
||||
result->f_list->pushBack(2);
|
||||
result->f_list->pushBack(3);
|
||||
result->field_string = "String Field";
|
||||
result->field_int32 = 5;
|
||||
result->field_list = List<Int32>::createShared();
|
||||
result->field_list->pushBack(1);
|
||||
result->field_list->pushBack(2);
|
||||
result->field_list->pushBack(3);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -60,22 +60,22 @@ class Test : public DTO {
|
||||
|
||||
DTO_INIT(Test, DTO)
|
||||
|
||||
DTO_FIELD(String, f_string);
|
||||
DTO_FIELD(Int32, f_int32);
|
||||
DTO_FIELD(Int64, f_int64);
|
||||
DTO_FIELD(Float32, f_float32);
|
||||
DTO_FIELD(Float64, f_float64);
|
||||
DTO_FIELD(Boolean, f_boolean);
|
||||
DTO_FIELD(String, field_string);
|
||||
DTO_FIELD(Int32, field_int32);
|
||||
DTO_FIELD(Int64, field_int64);
|
||||
DTO_FIELD(Float32, field_float32);
|
||||
DTO_FIELD(Float64, field_float64);
|
||||
DTO_FIELD(Boolean, field_boolean);
|
||||
|
||||
DTO_FIELD(List<String>::ObjectWrapper, f_list_string) = List<String>::createShared();
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, f_list_int32) = List<Int32>::createShared();
|
||||
DTO_FIELD(List<Int64>::ObjectWrapper, f_list_int64) = List<Int64>::createShared();
|
||||
DTO_FIELD(List<Float32>::ObjectWrapper, f_list_float32) = List<Float32>::createShared();
|
||||
DTO_FIELD(List<Float64>::ObjectWrapper, f_list_float64) = List<Float64>::createShared();
|
||||
DTO_FIELD(List<Boolean>::ObjectWrapper, f_list_boolean) = List<Boolean>::createShared();
|
||||
DTO_FIELD(List<String>::ObjectWrapper, field_list_string) = List<String>::createShared();
|
||||
DTO_FIELD(List<Int32>::ObjectWrapper, field_list_int32) = List<Int32>::createShared();
|
||||
DTO_FIELD(List<Int64>::ObjectWrapper, field_list_int64) = List<Int64>::createShared();
|
||||
DTO_FIELD(List<Float32>::ObjectWrapper, field_list_float32) = List<Float32>::createShared();
|
||||
DTO_FIELD(List<Float64>::ObjectWrapper, field_list_float64) = List<Float64>::createShared();
|
||||
DTO_FIELD(List<Boolean>::ObjectWrapper, field_list_boolean) = List<Boolean>::createShared();
|
||||
|
||||
DTO_FIELD(List<TestChild::ObjectWrapper>::ObjectWrapper, f_list_object) = List<TestChild::ObjectWrapper>::createShared();
|
||||
DTO_FIELD(List<List<TestChild::ObjectWrapper>::ObjectWrapper>::ObjectWrapper, f_list_list_object) = List<List<TestChild::ObjectWrapper>::ObjectWrapper>::createShared();
|
||||
DTO_FIELD(List<TestChild::ObjectWrapper>::ObjectWrapper, field_list_object) = List<TestChild::ObjectWrapper>::createShared();
|
||||
DTO_FIELD(List<List<TestChild::ObjectWrapper>::ObjectWrapper>::ObjectWrapper, field_list_list_object) = List<List<TestChild::ObjectWrapper>::ObjectWrapper>::createShared();
|
||||
|
||||
DTO_FIELD(Test::ObjectWrapper, obj1);
|
||||
DTO_FIELD(TestChild::ObjectWrapper, child1);
|
||||
@ -92,50 +92,50 @@ void DTOMapperTest::onRun(){
|
||||
|
||||
Test::ObjectWrapper test1 = Test::createShared();
|
||||
|
||||
test1->f_string = "string value";
|
||||
test1->f_int32 = 32;
|
||||
test1->f_int64 = 64;
|
||||
test1->f_float32 = 0.32;
|
||||
test1->f_float64 = 0.64;
|
||||
test1->f_boolean = true;
|
||||
test1->field_string = "string value";
|
||||
test1->field_int32 = 32;
|
||||
test1->field_int64 = 64;
|
||||
test1->field_float32 = 0.32;
|
||||
test1->field_float64 = 0.64;
|
||||
test1->field_boolean = true;
|
||||
|
||||
test1->obj1 = Test::createShared();
|
||||
test1->obj1->f_string = "inner string";
|
||||
test1->obj1->f_list_string->pushBack("inner str_item_1");
|
||||
test1->obj1->f_list_string->pushBack("inner str_item_2");
|
||||
test1->obj1->f_list_string->pushBack("inner str_item_3");
|
||||
test1->obj1->field_string = "inner string";
|
||||
test1->obj1->field_list_string->pushBack("inner str_item_1");
|
||||
test1->obj1->field_list_string->pushBack("inner str_item_2");
|
||||
test1->obj1->field_list_string->pushBack("inner str_item_3");
|
||||
|
||||
test1->child1 = TestChild::createShared();
|
||||
test1->child1->name = "child1_name";
|
||||
test1->child1->secondName = "child1_second_name";
|
||||
|
||||
test1->f_list_string->pushBack("str_item_1");
|
||||
test1->f_list_string->pushBack("str_item_2");
|
||||
test1->f_list_string->pushBack("str_item_3");
|
||||
test1->field_list_string->pushBack("str_item_1");
|
||||
test1->field_list_string->pushBack("str_item_2");
|
||||
test1->field_list_string->pushBack("str_item_3");
|
||||
|
||||
test1->f_list_int32->pushBack(321);
|
||||
test1->f_list_int32->pushBack(322);
|
||||
test1->f_list_int32->pushBack(323);
|
||||
test1->field_list_int32->pushBack(321);
|
||||
test1->field_list_int32->pushBack(322);
|
||||
test1->field_list_int32->pushBack(323);
|
||||
|
||||
test1->f_list_int64->pushBack(641);
|
||||
test1->f_list_int64->pushBack(642);
|
||||
test1->f_list_int64->pushBack(643);
|
||||
test1->field_list_int64->pushBack(641);
|
||||
test1->field_list_int64->pushBack(642);
|
||||
test1->field_list_int64->pushBack(643);
|
||||
|
||||
test1->f_list_float32->pushBack(0.321);
|
||||
test1->f_list_float32->pushBack(0.322);
|
||||
test1->f_list_float32->pushBack(0.323);
|
||||
test1->field_list_float32->pushBack(0.321);
|
||||
test1->field_list_float32->pushBack(0.322);
|
||||
test1->field_list_float32->pushBack(0.323);
|
||||
|
||||
test1->f_list_float64->pushBack(0.641);
|
||||
test1->f_list_float64->pushBack(0.642);
|
||||
test1->f_list_float64->pushBack(0.643);
|
||||
test1->field_list_float64->pushBack(0.641);
|
||||
test1->field_list_float64->pushBack(0.642);
|
||||
test1->field_list_float64->pushBack(0.643);
|
||||
|
||||
test1->f_list_boolean->pushBack(true);
|
||||
test1->f_list_boolean->pushBack(false);
|
||||
test1->f_list_boolean->pushBack(true);
|
||||
test1->field_list_boolean->pushBack(true);
|
||||
test1->field_list_boolean->pushBack(false);
|
||||
test1->field_list_boolean->pushBack(true);
|
||||
|
||||
test1->f_list_object->pushBack(TestChild::createShared("child", "1"));
|
||||
test1->f_list_object->pushBack(TestChild::createShared("child", "2"));
|
||||
test1->f_list_object->pushBack(TestChild::createShared("child", "3"));
|
||||
test1->field_list_object->pushBack(TestChild::createShared("child", "1"));
|
||||
test1->field_list_object->pushBack(TestChild::createShared("child", "2"));
|
||||
test1->field_list_object->pushBack(TestChild::createShared("child", "3"));
|
||||
|
||||
auto l1 = DTO::List<TestChild::ObjectWrapper>::createShared();
|
||||
auto l2 = DTO::List<TestChild::ObjectWrapper>::createShared();
|
||||
@ -153,9 +153,9 @@ void DTOMapperTest::onRun(){
|
||||
l3->pushBack(TestChild::createShared("list_3", "item_2"));
|
||||
l3->pushBack(TestChild::createShared("list_3", "item_3"));
|
||||
|
||||
test1->f_list_list_object->pushBack(l1);
|
||||
test1->f_list_list_object->pushBack(l2);
|
||||
test1->f_list_list_object->pushBack(l3);
|
||||
test1->field_list_list_object->pushBack(l1);
|
||||
test1->field_list_list_object->pushBack(l2);
|
||||
test1->field_list_list_object->pushBack(l3);
|
||||
|
||||
auto result = mapper->writeToString(test1);
|
||||
|
||||
@ -168,23 +168,23 @@ void DTOMapperTest::onRun(){
|
||||
oatpp::parser::Caret caret(result);
|
||||
auto obj = mapper->readFromCaret<Test>(caret);
|
||||
|
||||
OATPP_ASSERT(obj->f_string);
|
||||
OATPP_ASSERT(obj->f_string == test1->f_string);
|
||||
OATPP_ASSERT(obj->field_string);
|
||||
OATPP_ASSERT(obj->field_string == test1->field_string);
|
||||
|
||||
OATPP_ASSERT(obj->f_int32);
|
||||
OATPP_ASSERT(obj->f_int32->getValue() == test1->f_int32->getValue());
|
||||
OATPP_ASSERT(obj->field_int32);
|
||||
OATPP_ASSERT(obj->field_int32->getValue() == test1->field_int32->getValue());
|
||||
|
||||
OATPP_ASSERT(obj->f_int64);
|
||||
OATPP_ASSERT(obj->f_int64->getValue() == test1->f_int64->getValue());
|
||||
OATPP_ASSERT(obj->field_int64);
|
||||
OATPP_ASSERT(obj->field_int64->getValue() == test1->field_int64->getValue());
|
||||
|
||||
OATPP_ASSERT(obj->f_float32);
|
||||
OATPP_ASSERT(obj->f_float32->getValue() == test1->f_float32->getValue());
|
||||
OATPP_ASSERT(obj->field_float32);
|
||||
OATPP_ASSERT(obj->field_float32->getValue() == test1->field_float32->getValue());
|
||||
|
||||
OATPP_ASSERT(obj->f_float64);
|
||||
OATPP_ASSERT(obj->f_float64->getValue() == test1->f_float64->getValue());
|
||||
OATPP_ASSERT(obj->field_float64);
|
||||
OATPP_ASSERT(obj->field_float64->getValue() == test1->field_float64->getValue());
|
||||
|
||||
OATPP_ASSERT(obj->f_boolean);
|
||||
OATPP_ASSERT(obj->f_boolean->getValue() == test1->f_boolean->getValue());
|
||||
OATPP_ASSERT(obj->field_boolean);
|
||||
OATPP_ASSERT(obj->field_boolean->getValue() == test1->field_boolean->getValue());
|
||||
|
||||
result = mapper->writeToString(obj);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user