From: David Neto Date: Mon, 30 Nov 2015 18:45:20 +0000 (-0500) Subject: binary parse test: extra words after string literal X-Git-Tag: upstream/2018.6~1411 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36909c05a5248a28029ad1d04e80fe059cee237b;p=platform%2Fupstream%2FSPIRV-Tools.git binary parse test: extra words after string literal Covers the case where the string literal is the last operand. TODO: Case where one more operand is expected after the string literal. Occurs only for the LinkageAttributes decoration. To test that, we need to update the grammar as well. --- diff --git a/test/BinaryParse.cpp b/test/BinaryParse.cpp index 8c59c86..95b993b 100644 --- a/test/BinaryParse.cpp +++ b/test/BinaryParse.cpp @@ -547,6 +547,14 @@ INSTANTIATE_TEST_CASE_P( {spvOpcodeMake(3, SpvOpString), 1, 0x41414141, 0}}), "Invalid word count: OpString starting at word 5 says it has 3" " words, but found 4 words instead."}, + // Word count is too large. The string terminates before the last + // word. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(4, SpvOpString), 1 /* result id */}, + MakeVector("abc"), + {0 /* this word does not belong*/}}), + "Invalid instruction OpString starting at word 5: expected no more" + " operands after 3 words, but stated word count is 4."}, {Concatenate({ExpectedHeaderForBound(2), {spvOpcodeMake(2, SpvOpTypeVoid), 0}}), "Error: Result Id is 0"},