diff options
author | Josh Haberman <jhaberman@gmail.com> | 2015-08-19 15:49:29 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2015-08-19 15:49:29 -0700 |
commit | 1e870951d7707d45fa7104658a4dde177d9fb62e (patch) | |
tree | a307fbb9bf6dbd7930be74ff481631486dc3b494 /tests/pb/test_decoder.cc | |
parent | 146a9c22efac6cb746ef4024144f28af891dd2b4 (diff) |
Refer to a shared definition for max buffered bytes.
Diffstat (limited to 'tests/pb/test_decoder.cc')
-rw-r--r-- | tests/pb/test_decoder.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/pb/test_decoder.cc b/tests/pb/test_decoder.cc index 94293cb..a01e999 100644 --- a/tests/pb/test_decoder.cc +++ b/tests/pb/test_decoder.cc @@ -570,15 +570,14 @@ uint32_t Hash(const string& proto, const string* expected_output, size_t seam1, } void CheckBytesParsed(const upb::pb::Decoder& decoder, size_t ofs) { - // We could have parsed as many as 10 bytes fewer than what the decoder - // previously accepted, since we can buffer up to 12 partial bytes internally - // before accumulating an entire value. - const int MAX_BUFFERED = 14; - // We can't have parsed more data than the decoder callback is telling us it // parsed. ASSERT(decoder.BytesParsed() <= ofs); - ASSERT(ofs <= (decoder.BytesParsed() + MAX_BUFFERED)); + + // The difference between what we've decoded and what the decoder has accepted + // represents the internally buffered amount. This amount should not exceed + // this value which comes from decoder.int.h. + ASSERT(ofs <= (decoder.BytesParsed() + UPB_DECODER_MAX_RESIDUAL_BYTES)); } static bool parse(VerboseParserEnvironment* env, |