From 1e870951d7707d45fa7104658a4dde177d9fb62e Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Wed, 19 Aug 2015 15:49:29 -0700 Subject: Refer to a shared definition for max buffered bytes. --- tests/pb/test_decoder.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/pb/test_decoder.cc') 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, -- cgit v1.2.3