github.com/go-maxhub/gremlins@v1.0.1-0.20231227222204-b03a6a1e3e09/core/configuration/mutantenabled.go (about)

     1  /*
     2   * Copyright 2022 The Gremlins Authors
     3   *
     4   *    Licensed under the Apache License, Version 2.0 (the "License");
     5   *    you may not use this file except in compliance with the License.
     6   *    You may obtain a copy of the License at
     7   *
     8   *        http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   *    Unless required by applicable law or agreed to in writing, software
    11   *    distributed under the License is distributed on an "AS IS" BASIS,
    12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   *    See the License for the specific language governing permissions and
    14   *    limitations under the License.
    15   */
    16  
    17  package configuration
    18  
    19  import (
    20  	"github.com/go-maxhub/gremlins/core/mutator"
    21  )
    22  
    23  var mutationEnabled = map[mutator.Type]bool{
    24  	mutator.ArithmeticBase:           true,
    25  	mutator.ConditionalsBoundary:     true,
    26  	mutator.ConditionalsNegation:     true,
    27  	mutator.IncrementDecrement:       true,
    28  	mutator.InvertAssignments:        false,
    29  	mutator.InvertBitwise:            false,
    30  	mutator.InvertBitwiseAssignments: false,
    31  	mutator.InvertLogical:            false,
    32  	mutator.InvertLoopCtrl:           false,
    33  	mutator.InvertNegatives:          true,
    34  	mutator.RemoveSelfAssignments:    false,
    35  }
    36  
    37  // IsDefaultEnabled returns the default enabled/disabled state of the mutation.
    38  // It gets the state from the table above that must be kept up to date when adding
    39  // new mutant types.
    40  func IsDefaultEnabled(mt mutator.Type) bool {
    41  	return mutationEnabled[mt]
    42  }