[codeface] [PATCH 07/26] Fix feature-related tests regarding 'Base_Feature'

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 13 Oct 2016 17:29:39 +0200

As the addtion of the 'Base_Feature' as 'Feature' and
'FeatureExpression' to the 'commit_dependency' table broke the test
suite, the tests needed a fix. This patch gets the tests going green
again.

Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
---
 codeface/test/integration/test_features.py | 28 ++++++++++++----
 codeface/test/unit/test_cppstats_works.py  |  8 ++---
 codeface/test/unit/test_getFeatureLines.py | 52 +++++++++++++++---------------
 3 files changed, 51 insertions(+), 37 deletions(-)

diff --git a/codeface/test/integration/test_features.py 
b/codeface/test/integration/test_features.py
index ffd0510..69ba434 100644
--- a/codeface/test/integration/test_features.py
+++ b/codeface/test/integration/test_features.py
@@ -211,12 +211,10 @@ class TestEndToEndOnlyTaggingExample3Feature(
             ('f95b8047236f75641d6d7a2b5790b9e1db869ccd', 'src/carp.c',
             '(defined(A) || defined(B))', 'FeatureExpression', 1, None),
 
-            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
-             'A', 'Feature', 1, None),
-            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
-             'B', 'Feature', 1, None),
-            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
-            '(defined(A) || defined(B))', 'FeatureExpression', 1, None),
+            ('3b7cc950b4446fa4a3e06a6cf0992ded1a5fe923', 'src/carp.c',
+             'Base_Feature', 'Feature', 1, None),
+            ('3b7cc950b4446fa4a3e06a6cf0992ded1a5fe923', 'src/carp.c',
+             'Base_Feature', 'FeatureExpression', 1, None),
 
             ('3fe9884f98487cce4603d2bd5578e94944412d3c', 'src/carp.c',
              'A', 'Feature', 1, None),
@@ -225,6 +223,13 @@ class TestEndToEndOnlyTaggingExample3Feature(
             ('3fe9884f98487cce4603d2bd5578e94944412d3c', 'src/carp.c',
             '(defined(A) || defined(B))', 'FeatureExpression', 1, None),
 
+            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
+             'A', 'Feature', 1, None),
+            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
+             'B', 'Feature', 1, None),
+            ('7b16cf10845bc64e2589fa63822f3ddc49aedd4d', 'src/carp.c',
+             '(defined(A) || defined(B))', 'FeatureExpression', 1, None),
+
             # Release 2 (see blame data above)
             ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
              'A', 'Feature', 4, None),
@@ -233,6 +238,8 @@ class TestEndToEndOnlyTaggingExample3Feature(
             ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
              'C', 'Feature', 2, None),
             ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
+             'Base_Feature', 'Feature', 5, None),
+            ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
             '(defined(C))', 'FeatureExpression', 2, None),
             ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
             '(defined(A))', 'FeatureExpression', 1, None),
@@ -240,6 +247,8 @@ class TestEndToEndOnlyTaggingExample3Feature(
             '(!((defined(A)))) && ((defined(B)))', 'FeatureExpression', 1, 
None),
             ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
             '(!((defined(A)))) && (!((defined(B))))', 'FeatureExpression', 2, 
None),
+            ('c9b59046b6eb473b97a97cb31aded2deced29dc6', 'src/code.c',
+             'Base_Feature', 'FeatureExpression', 5, None),
 
             ('29b9c8bc6955df51263201dff7a1d935f8cd6049', 'src/code.c',
              'C', 'Feature', 1, None),
@@ -262,7 +271,12 @@ class TestEndToEndOnlyTaggingExample3Feature(
             ('55eec10019857e44d80e4bec3e81d1cffb785592', 'src/carp.c',
              'B', 'Feature', 1, None),
             ('55eec10019857e44d80e4bec3e81d1cffb785592', 'src/carp.c',
-            '(defined(A) || defined(B))', 'FeatureExpression', 1, None)
+            '(defined(A) || defined(B))', 'FeatureExpression', 1, None),
+
+            ('2d29196c16dd5a2d4bed292f055a83d1b44a58e1', 'src/carp.c',
+             'Base_Feature', 'Feature', 1, None),
+            ('2d29196c16dd5a2d4bed292f055a83d1b44a58e1', 'src/carp.c',
+             'Base_Feature', 'FeatureExpression', 1, None)
         ]
 
 
diff --git a/codeface/test/unit/test_cppstats_works.py 
b/codeface/test/unit/test_cppstats_works.py
index c401c24..075aba3 100644
--- a/codeface/test/unit/test_cppstats_works.py
+++ b/codeface/test/unit/test_cppstats_works.py
@@ -69,20 +69,20 @@ class TestCppStatsWorks(unittest.TestCase):
         d = self._get_file_layout(file)
         feature_dict, fexpr_lines = get_feature_lines_from_file(d, 
"unittest.c")
 
-        self.assertSetEqual(feature_dict.get_line_info(1), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(1), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(2), set(["Test"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["Test"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["Test"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["Test"]))
         self.assertSetEqual(feature_dict.get_line_info(6), set(["Test"]))
-        self.assertSetEqual(feature_dict.get_line_info(7), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(7), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_lines.get_line_info(1), set([]))
+        self.assertSetEqual(fexpr_lines.get_line_info(1), 
set(["Base_Feature"]))
         self.assertSetEqual(fexpr_lines.get_line_info(2), set(["Test"]))
         self.assertSetEqual(fexpr_lines.get_line_info(3), set(["Test"]))
         self.assertSetEqual(fexpr_lines.get_line_info(4), set(["!(Test)"]))
         self.assertSetEqual(fexpr_lines.get_line_info(5), set(["!(Test)"]))
         self.assertSetEqual(fexpr_lines.get_line_info(6), set(["!(Test)"]))
-        self.assertSetEqual(fexpr_lines.get_line_info(7), set([]))
+        self.assertSetEqual(fexpr_lines.get_line_info(7), 
set(["Base_Feature"]))
 
         pass
diff --git a/codeface/test/unit/test_getFeatureLines.py 
b/codeface/test/unit/test_getFeatureLines.py
index 3de29ed..d009ec8 100644
--- a/codeface/test/unit/test_getFeatureLines.py
+++ b/codeface/test/unit/test_getFeatureLines.py
@@ -116,17 +116,17 @@ class TestFeatureLines(unittest.TestCase):
         feature_dict, fexpr_dict = \
             get_feature_lines([(3, 5, LineType.IF, ["A", "B"], "defined(A) && 
defined(B)")],
                               "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["A", "B"]))
-        self.assertSetEqual(feature_dict.get_line_info(6), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(6), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]))
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5), set(["defined(A) && 
defined(B)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(6), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(6), set(["Base_Feature"]))
 
         pass
 
@@ -137,23 +137,23 @@ class TestFeatureLines(unittest.TestCase):
                 [(3, 5, LineType.IF, ["A", "B"], "defined(A) && defined(B)"),
                  (6, 8, LineType.IF, ["C", "D"], "defined(C) && defined(D)")],
                 "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(6), set(["C", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(7), set(["C", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(8), set(["C", "D"]))
-        self.assertSetEqual(feature_dict.get_line_info(9), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(9), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]))
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(6), set(["defined(C) && 
defined(D)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(7), set(["defined(C) && 
defined(D)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(8), set(["defined(C) && 
defined(D)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(9), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(9), set(["Base_Feature"]))
         pass
 
     def testorderdoesntmatter(self):
@@ -163,23 +163,23 @@ class TestFeatureLines(unittest.TestCase):
                 [(6, 8, LineType.IF, ["C", "D"], "defined(C) && defined(D)"),
                  (3, 5, LineType.IF, ["A", "B"], "defined(A) && defined(B)")],
                 "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(6), set(["C", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(7), set(["C", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(8), set(["C", "D"]))
-        self.assertSetEqual(feature_dict.get_line_info(9), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(9), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]))
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(6), set(["defined(C) && 
defined(D)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(7), set(["defined(C) && 
defined(D)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(8), set(["defined(C) && 
defined(D)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(9), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(9), set(["Base_Feature"]))
 
         pass
 
@@ -191,7 +191,7 @@ class TestFeatureLines(unittest.TestCase):
                  (6, 8, LineType.IF, ["C", "D"],
                   "(defined(A) && defined(B)) && (defined(C) && defined(D))")],
                 "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["A", "B"]))
@@ -202,9 +202,9 @@ class TestFeatureLines(unittest.TestCase):
         self.assertSetEqual(feature_dict.get_line_info(8),
                             set(["A", "B", "C", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(9), set(["A", "B"]))
-        self.assertSetEqual(feature_dict.get_line_info(10), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(10), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]))
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5), set(["defined(A) && 
defined(B)"]))
@@ -215,7 +215,7 @@ class TestFeatureLines(unittest.TestCase):
         self.assertSetEqual(fexpr_dict.get_line_info(8),
                             set(["(defined(A) && defined(B)) && (defined(C) && 
defined(D))"]))
         self.assertSetEqual(fexpr_dict.get_line_info(9), set(["defined(A) && 
defined(B)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(10), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(10), 
set(["Base_Feature"]))
         pass
 
     def testnestingwithsamefeatures(self):
@@ -227,8 +227,8 @@ class TestFeatureLines(unittest.TestCase):
                  (6, 8, LineType.IF, ["A", "D"],
                   "(defined(A) && defined(B)) && (defined(D))")],
                 "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]),
-                            "line 2 should be empty")
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]),
+                            "line 2 should contain the Base_Feature")
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5), set(["A", "B"]))
@@ -239,10 +239,10 @@ class TestFeatureLines(unittest.TestCase):
         self.assertSetEqual(feature_dict.get_line_info(8),
                             set(["A", "B", "D"]))
         self.assertSetEqual(feature_dict.get_line_info(9), set(["A", "B"]))
-        self.assertSetEqual(feature_dict.get_line_info(10), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(10), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]),
-                            "line 2 should be empty")
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]),
+                            "line 2 should contain the Base_Feature")
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5), set(["defined(A) && 
defined(B)"]))
@@ -253,7 +253,7 @@ class TestFeatureLines(unittest.TestCase):
         self.assertSetEqual(fexpr_dict.get_line_info(8),
                             set(["(defined(A) && defined(B)) && 
(defined(D))"]))
         self.assertSetEqual(fexpr_dict.get_line_info(9), set(["defined(A) && 
defined(B)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(10), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(10), 
set(["Base_Feature"]))
         pass
 
     def testinvalidstartend(self):
@@ -287,21 +287,21 @@ class TestFeatureLines(unittest.TestCase):
                 [(3, 5, LineType.IF, ["A", "B"], "defined(A) && defined(B)"),
                  (5, 6, LineType.ELIF, ["A", "B", "C"], "(!(defined(A)) && 
(!(defined(B)) && defined(C)")],
                 "unittest.c")
-        self.assertSetEqual(feature_dict.get_line_info(2), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(2), 
set(["Base_Feature"]))
         self.assertSetEqual(feature_dict.get_line_info(3), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(4), set(["A", "B"]))
         self.assertSetEqual(feature_dict.get_line_info(5),
                             set(["A", "B", "C"]))
         self.assertSetEqual(feature_dict.get_line_info(6),
                             set(["A", "B", "C"]))
-        self.assertSetEqual(feature_dict.get_line_info(7), set([]))
+        self.assertSetEqual(feature_dict.get_line_info(7), 
set(["Base_Feature"]))
 
-        self.assertSetEqual(fexpr_dict.get_line_info(2), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(2), set(["Base_Feature"]))
         self.assertSetEqual(fexpr_dict.get_line_info(3), set(["defined(A) && 
defined(B)"]), fexpr_dict.get_line_info(3))
         self.assertSetEqual(fexpr_dict.get_line_info(4), set(["defined(A) && 
defined(B)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(5),
                             set(["(!(defined(A)) && (!(defined(B)) && 
defined(C)"]))
         self.assertSetEqual(fexpr_dict.get_line_info(6),
                             set(["(!(defined(A)) && (!(defined(B)) && 
defined(C)"]))
-        self.assertSetEqual(fexpr_dict.get_line_info(7), set([]))
+        self.assertSetEqual(fexpr_dict.get_line_info(7), set(["Base_Feature"]))
         pass
-- 
2.10.0


Other related posts: