github.com/go-maxhub/gremlins@v1.0.1-0.20231227222204-b03a6a1e3e09/core/report/internal/structure.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 internal
    18  
    19  // OutputResult is the data structure for the Gremlins file output format.
    20  type OutputResult struct {
    21  	GoModule          string       `json:"go_module"`
    22  	Files             []OutputFile `json:"files"`
    23  	TestEfficacy      float64      `json:"test_efficacy"`
    24  	MutationsCoverage float64      `json:"mutations_coverage"`
    25  	MutantsTotal      int          `json:"mutants_total"`
    26  	MutantsKilled     int          `json:"mutants_killed"`
    27  	MutantsLived      int          `json:"mutants_lived"`
    28  	MutantsNotViable  int          `json:"mutants_not_viable"`
    29  	MutantsNotCovered int          `json:"mutants_not_covered"`
    30  	ElapsedTime       float64      `json:"elapsed_time"`
    31  	MutatorStatistics MutatorType  `json:"mutator_statistics"`
    32  }
    33  
    34  // OutputFile represents a single file in the OutputResult data structure.
    35  type OutputFile struct {
    36  	Filename  string     `json:"file_name"`
    37  	Mutations []Mutation `json:"mutations"`
    38  }
    39  
    40  // Mutation represents a single mutation in the OutputResult data structure.
    41  type Mutation struct {
    42  	Type   string `json:"type"`
    43  	Status string `json:"status"`
    44  	Line   int    `json:"line"`
    45  	Column int    `json:"column"`
    46  }
    47  
    48  // MutatorType contains the list of all supported mutator types.
    49  type MutatorType struct {
    50  	ArithmeticBase           int `json:"arithmetic_base,omitempty"`
    51  	ConditionalsNegation     int `json:"conditionals_negation,omitempty"`
    52  	ConditionalsBoundary     int `json:"conditionals_boundary,omitempty"`
    53  	IncrementDecrement       int `json:"increment_decrement,omitempty"`
    54  	InvertAssignments        int `json:"invert_assignments,omitempty"`
    55  	InvertBitwise            int `json:"invert_bitwise,omitempty"`
    56  	InvertBitwiseAssignments int `json:"invert_bitwise_assignments,omitempty"`
    57  	InvertLogical            int `json:"invert_logical,omitempty"`
    58  	InvertLoopCtrl           int `json:"invert_loop_ctrl,omitempty"`
    59  	InvertNegatives          int `json:"invert_negatives,omitempty"`
    60  	RemoveSelfAssignments    int `json:"remove_self_assignments,omitempty"`
    61  }