Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
fcb92682
Commit
fcb92682
authored
Jun 29, 2017
by
Yilun Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change java to uniform message, revert TestValidDataForType's parameters
parent
020a24df
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
22 deletions
+17
-22
ConformanceJava.java
conformance/ConformanceJava.java
+0
-0
conformance_test.cc
conformance/conformance_test.cc
+16
-20
conformance_test.h
conformance/conformance_test.h
+1
-2
No files found.
conformance/ConformanceJava.java
View file @
fcb92682
This diff is collapsed.
Click to expand it.
conformance/conformance_test.cc
View file @
fcb92682
...
@@ -674,7 +674,8 @@ void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) {
...
@@ -674,7 +674,8 @@ void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) {
void
ConformanceTestSuite
::
TestValidDataForType
(
void
ConformanceTestSuite
::
TestValidDataForType
(
FieldDescriptor
::
Type
type
,
FieldDescriptor
::
Type
type
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
values
,
bool
isProto3
)
{
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
values
)
{
for
(
int
isProto3
=
0
;
isProto3
<
2
;
isProto3
++
)
{
const
string
type_name
=
const
string
type_name
=
UpperCase
(
string
(
"."
)
+
FieldDescriptor
::
TypeName
(
type
));
UpperCase
(
string
(
"."
)
+
FieldDescriptor
::
TypeName
(
type
));
WireFormatLite
::
WireType
wire_type
=
WireFormatLite
::
WireTypeForFieldType
(
WireFormatLite
::
WireType
wire_type
=
WireFormatLite
::
WireTypeForFieldType
(
...
@@ -703,6 +704,7 @@ void ConformanceTestSuite::TestValidDataForType(
...
@@ -703,6 +704,7 @@ void ConformanceTestSuite::TestValidDataForType(
}
}
RunValidProtobufTest
(
"ValidDataRepeated"
+
type_name
,
REQUIRED
,
RunValidProtobufTest
(
"ValidDataRepeated"
+
type_name
,
REQUIRED
,
proto
,
text
,
isProto3
);
proto
,
text
,
isProto3
);
}
}
}
void
ConformanceTestSuite
::
SetFailureList
(
const
string
&
filename
,
void
ConformanceTestSuite
::
SetFailureList
(
const
string
&
filename
,
...
@@ -793,29 +795,23 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
...
@@ -793,29 +795,23 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
{
dbl
(
0.1
),
"0.1"
},
{
dbl
(
0.1
),
"0.1"
},
{
dbl
(
1.7976931348623157e+308
),
"1.7976931348623157e+308"
},
{
dbl
(
1.7976931348623157e+308
),
"1.7976931348623157e+308"
},
{
dbl
(
2.22507385850720138309e-308
),
"2.22507385850720138309e-308"
}
{
dbl
(
2.22507385850720138309e-308
),
"2.22507385850720138309e-308"
}
},
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_DOUBLE
,
{
{
dbl
(
0.1
),
"0.1"
},
{
dbl
(
1.7976931348623157e+308
),
"1.7976931348623157e+308"
},
{
dbl
(
2.22507385850720138309e-308
),
"2.22507385850720138309e-308"
}
},
false
);
TestValidDataForType
(
FieldDescriptor
::
TYPE_FLOAT
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_FLOAT
,
{
{
flt
(
0.1
),
"0.1"
},
{
flt
(
0.1
),
"0.1"
},
{
flt
(
1.00000075e-36
),
"1.00000075e-36"
},
{
flt
(
1.00000075e-36
),
"1.00000075e-36"
},
{
flt
(
3.402823e+38
),
"3.402823e+38"
},
// 3.40282347e+38
{
flt
(
3.402823e+38
),
"3.402823e+38"
},
// 3.40282347e+38
{
flt
(
1.17549435e-38
f
),
"1.17549435e-38"
}
{
flt
(
1.17549435e-38
f
),
"1.17549435e-38"
}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_INT64
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_INT64
,
{
{
varint
(
12345
),
"12345"
},
{
varint
(
12345
),
"12345"
},
{
varint
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
varint
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
varint
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
{
varint
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_UINT64
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_UINT64
,
{
{
varint
(
12345
),
"12345"
},
{
varint
(
12345
),
"12345"
},
{
varint
(
kUint64Max
),
std
::
to_string
(
kUint64Max
)},
{
varint
(
kUint64Max
),
std
::
to_string
(
kUint64Max
)},
{
varint
(
0
),
"0"
}
{
varint
(
0
),
"0"
}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_INT32
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_INT32
,
{
{
varint
(
12345
),
"12345"
},
{
varint
(
12345
),
"12345"
},
{
longvarint
(
12345
,
2
),
"12345"
},
{
longvarint
(
12345
,
2
),
"12345"
},
...
@@ -825,7 +821,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
...
@@ -825,7 +821,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
{
varint
(
1LL
<<
33
),
std
::
to_string
(
static_cast
<
int32
>
(
1LL
<<
33
))},
{
varint
(
1LL
<<
33
),
std
::
to_string
(
static_cast
<
int32
>
(
1LL
<<
33
))},
{
varint
((
1LL
<<
33
)
-
1
),
{
varint
((
1LL
<<
33
)
-
1
),
std
::
to_string
(
static_cast
<
int32
>
((
1LL
<<
33
)
-
1
))},
std
::
to_string
(
static_cast
<
int32
>
((
1LL
<<
33
)
-
1
))},
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_UINT32
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_UINT32
,
{
{
varint
(
12345
),
"12345"
},
{
varint
(
12345
),
"12345"
},
{
longvarint
(
12345
,
2
),
"12345"
},
{
longvarint
(
12345
,
2
),
"12345"
},
...
@@ -835,42 +831,42 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
...
@@ -835,42 +831,42 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
{
varint
(
1LL
<<
33
),
std
::
to_string
(
static_cast
<
uint32
>
(
1LL
<<
33
))},
{
varint
(
1LL
<<
33
),
std
::
to_string
(
static_cast
<
uint32
>
(
1LL
<<
33
))},
{
varint
((
1LL
<<
33
)
-
1
),
{
varint
((
1LL
<<
33
)
-
1
),
std
::
to_string
(
static_cast
<
uint32
>
((
1LL
<<
33
)
-
1
))},
std
::
to_string
(
static_cast
<
uint32
>
((
1LL
<<
33
)
-
1
))},
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_FIXED64
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_FIXED64
,
{
{
u64
(
12345
),
"12345"
},
{
u64
(
12345
),
"12345"
},
{
u64
(
kUint64Max
),
std
::
to_string
(
kUint64Max
)},
{
u64
(
kUint64Max
),
std
::
to_string
(
kUint64Max
)},
{
u64
(
0
),
"0"
}
{
u64
(
0
),
"0"
}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_FIXED32
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_FIXED32
,
{
{
u32
(
12345
),
"12345"
},
{
u32
(
12345
),
"12345"
},
{
u32
(
kUint32Max
),
std
::
to_string
(
kUint32Max
)},
// UINT32_MAX
{
u32
(
kUint32Max
),
std
::
to_string
(
kUint32Max
)},
// UINT32_MAX
{
u32
(
0
),
"0"
}
{
u32
(
0
),
"0"
}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_SFIXED64
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_SFIXED64
,
{
{
u64
(
12345
),
"12345"
},
{
u64
(
12345
),
"12345"
},
{
u64
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
u64
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
u64
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
{
u64
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_SFIXED32
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_SFIXED32
,
{
{
u32
(
12345
),
"12345"
},
{
u32
(
12345
),
"12345"
},
{
u32
(
kInt32Max
),
std
::
to_string
(
kInt32Max
)},
{
u32
(
kInt32Max
),
std
::
to_string
(
kInt32Max
)},
{
u32
(
kInt32Min
),
std
::
to_string
(
kInt32Min
)}
{
u32
(
kInt32Min
),
std
::
to_string
(
kInt32Min
)}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_BOOL
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_BOOL
,
{
{
varint
(
1
),
"true"
},
{
varint
(
1
),
"true"
},
{
varint
(
0
),
"false"
},
{
varint
(
0
),
"false"
},
{
varint
(
12345678
),
"true"
}
{
varint
(
12345678
),
"true"
}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_SINT32
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_SINT32
,
{
{
zz32
(
12345
),
"12345"
},
{
zz32
(
12345
),
"12345"
},
{
zz32
(
kInt32Max
),
std
::
to_string
(
kInt32Max
)},
{
zz32
(
kInt32Max
),
std
::
to_string
(
kInt32Max
)},
{
zz32
(
kInt32Min
),
std
::
to_string
(
kInt32Min
)}
{
zz32
(
kInt32Min
),
std
::
to_string
(
kInt32Min
)}
}
,
true
);
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_SINT64
,
{
TestValidDataForType
(
FieldDescriptor
::
TYPE_SINT64
,
{
{
zz64
(
12345
),
"12345"
},
{
zz64
(
12345
),
"12345"
},
{
zz64
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
zz64
(
kInt64Max
),
std
::
to_string
(
kInt64Max
)},
{
zz64
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
{
zz64
(
kInt64Min
),
std
::
to_string
(
kInt64Min
)}
}
,
true
);
});
// TODO(haberman):
// TODO(haberman):
// TestValidDataForType(FieldDescriptor::TYPE_STRING
// TestValidDataForType(FieldDescriptor::TYPE_STRING
...
...
conformance/conformance_test.h
View file @
fcb92682
...
@@ -210,8 +210,7 @@ class ConformanceTestSuite {
...
@@ -210,8 +210,7 @@ class ConformanceTestSuite {
void
TestIllegalTags
();
void
TestIllegalTags
();
void
TestValidDataForType
(
void
TestValidDataForType
(
google
::
protobuf
::
FieldDescriptor
::
Type
,
google
::
protobuf
::
FieldDescriptor
::
Type
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
values
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
values
);
bool
isProto3
);
bool
CheckSetEmpty
(
const
set
<
string
>&
set_to_check
,
bool
CheckSetEmpty
(
const
set
<
string
>&
set_to_check
,
const
std
::
string
&
write_to_file
,
const
std
::
string
&
msg
);
const
std
::
string
&
write_to_file
,
const
std
::
string
&
msg
);
ConformanceTestRunner
*
runner_
;
ConformanceTestRunner
*
runner_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment