Skip to content

Mutant testing: No test fails if preprocessing condition is reversed #1432

@hzeller

Description

@hzeller

Consider the following: here we change the value of if_condition to mean the reverse.

--- a/verilog/analysis/flow_tree.cc
+++ b/verilog/analysis/flow_tree.cc
@@ -192,7 +192,7 @@ absl::Status FlowTree::GenerateControlFlowTree() {
         case PP_ifdef: {
           if_blocks_.push_back(empty_block);
           if_blocks_.back().if_location = iter;
-          if_blocks_.back().positive_condition = 1;
+          if_blocks_.back().positive_condition = 0;
           auto status = AddMacroOfConditional(iter);
           if (!status.ok()) {
             return absl::InvalidArgumentError(
@@ -203,7 +203,7 @@ absl::Status FlowTree::GenerateControlFlowTree() {
         case PP_ifndef: {
           if_blocks_.push_back(empty_block);
           if_blocks_.back().if_location = iter;
-          if_blocks_.back().positive_condition = 0;
+          if_blocks_.back().positive_condition = 1;
           auto status = AddMacroOfConditional(iter);
           if (!status.ok()) {
             return absl::InvalidArgumentError(

Running all tests still pass afterwards. So existing tests do not probe enough to discover it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions