From b50f554b28f37f15b41d8fc3512e49a07bf4f392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 27 Jul 2015 16:25:14 +0200 Subject: [PATCH] TestValueFlow::valueFlowArrayElement: Refactoring tests --- test/testvalueflow.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index aac2f7e1c..ea98b2b4c 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -204,18 +204,22 @@ private: const char *code; code = "void f() {\n" - " const int a[] = {43,23,12};\n" - " int x = a[0];\n" + " const int x[] = {43,23,12};\n" " return x;\n" "}"; - ASSERT_EQUALS(true, testValueOfX(code, 4U, 43)); + ASSERT_EQUALS(true, testValueOfX(code, 3U, "{ 43 , 23 , 12 }")); code = "void f() {\n" - " const char abcd[] = \"abcd\";\n" - " int x = abcd[2];\n" + " const char x[] = \"abcd\";\n" " return x;\n" "}"; - ASSERT_EQUALS(true, testValueOfX(code, 4U, 'c')); + ASSERT_EQUALS(true, testValueOfX(code, 3U, "\"abcd\"")); + + code = "void f() {\n" + " char x[32] = \"abcd\";\n" + " return x;\n" + "}"; + TODO_ASSERT_EQUALS(true, false, testValueOfX(code, 3U, "\"abcd\"")); } void valueFlowCalculations() {