Ticket #6588: Added test cases since the initial issue is fixed by some past commit.

This commit is contained in:
Simon Martin 2015-05-30 22:57:54 +02:00
parent 9c6ce2b06b
commit 764df4dd56
2 changed files with 16 additions and 0 deletions

View File

@ -135,6 +135,16 @@ private:
" X *p = new ::std::pair<int,int>[rSize];\n"
"}");
ASSERT_EQUALS("", errout.str());
// ticket #6588
check("struct MpegEncContext { int *q_intra_matrix, *q_chroma_intra_matrix; };\n"
"void dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int n, int qscale) {\n"
" const int *qmat = n < 4;\n" /* KO */
" const int *rmat = n < 4 ? " /* OK */
" ctx->q_intra_matrix :"
" ctx->q_chroma_intra_matrix;\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Boolean value assigned to pointer.\n", errout.str());
}
void assignBoolToFloat() {

View File

@ -587,6 +587,12 @@ private:
invalidFunctionUsage("int f() { memset(a,b,sizeof(a)!=0); }");
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
invalidFunctionUsage("void record(char* buf, int n) {\n"
" memset(buf, 0, n < 255);\n" /* KO */
" memset(buf, 0, n < 255 ? n : 255);\n" /* OK */
"}");
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid memset() argument nr 3. A non-boolean value is required.\n", errout.str());
invalidFunctionUsage("int f() { strtol(a,b,sizeof(a)!=12); }");
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (comparison result) but the valid values are '0,2:36'.\n", errout.str());