Skip to content

Commit afab8d4

Browse files
committed
fuzz, refactor: Remove Serialize overload
Serialization parameters should be embedded into the object being serialized rather than passed as a separate argument. This works here because only serialization is performed and no new object needs to be constructed.
1 parent efa7f8c commit afab8d4

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

‎src/test/fuzz/deserialize.cpp‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ namespace {
5757
struct invalid_fuzzing_input_exception : public std::exception {
5858
};
5959

60-
template <typename T, typename P>
61-
DataStream Serialize(const T& obj, const P& params)
62-
{
63-
DataStream ds{};
64-
ds << params(obj);
65-
return ds;
66-
}
67-
6860
template <typename T, typename P>
6961
T Deserialize(DataStream&& ds, const P& params)
7062
{
@@ -116,7 +108,7 @@ T DeserializeConstructFromFuzzingInput(FuzzBufferType buffer)
116108
template <typename T, typename P>
117109
void AssertEqualAfterSerializeDeserialize(const T& obj, const P& params)
118110
{
119-
assert(Deserialize<T>(Serialize(obj, params), params) == obj);
111+
assert(Deserialize<T>(Serialize(params(obj)), params) == obj);
120112
}
121113
template <typename T>
122114
void AssertEqualAfterSerializeDeserialize(const T& obj)

0 commit comments

Comments
 (0)