mutant 0.8.10 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -4
- data/Changelog.md +8 -0
- data/README.md +112 -43
- data/Rakefile +2 -16
- data/circle.yml +1 -1
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/reek.yml +3 -4
- data/config/rubocop.yml +53 -16
- data/lib/mutant.rb +27 -6
- data/lib/mutant/ast/meta/const.rb +2 -0
- data/lib/mutant/ast/meta/optarg.rb +2 -0
- data/lib/mutant/ast/meta/resbody.rb +2 -0
- data/lib/mutant/ast/meta/restarg.rb +2 -0
- data/lib/mutant/ast/meta/send.rb +4 -0
- data/lib/mutant/ast/meta/symbol.rb +2 -0
- data/lib/mutant/ast/named_children.rb +14 -4
- data/lib/mutant/ast/nodes.rb +3 -1
- data/lib/mutant/ast/regexp.rb +53 -0
- data/lib/mutant/ast/regexp/transformer.rb +185 -0
- data/lib/mutant/ast/regexp/transformer/alternative.rb +39 -0
- data/lib/mutant/ast/regexp/transformer/character_set.rb +46 -0
- data/lib/mutant/ast/regexp/transformer/direct.rb +99 -0
- data/lib/mutant/ast/regexp/transformer/options_group.rb +66 -0
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +112 -0
- data/lib/mutant/ast/regexp/transformer/recursive.rb +50 -0
- data/lib/mutant/ast/regexp/transformer/root.rb +29 -0
- data/lib/mutant/ast/regexp/transformer/text.rb +55 -0
- data/lib/mutant/ast/types.rb +92 -5
- data/lib/mutant/cli.rb +2 -14
- data/lib/mutant/color.rb +1 -1
- data/lib/mutant/config.rb +1 -3
- data/lib/mutant/expression/methods.rb +1 -1
- data/lib/mutant/expression/namespace.rb +2 -2
- data/lib/mutant/expression/parser.rb +1 -1
- data/lib/mutant/integration.rb +10 -28
- data/lib/mutant/isolation.rb +9 -60
- data/lib/mutant/isolation/fork.rb +72 -0
- data/lib/mutant/isolation/none.rb +25 -0
- data/lib/mutant/matcher/config.rb +2 -0
- data/lib/mutant/matcher/method/singleton.rb +5 -4
- data/lib/mutant/meta.rb +11 -4
- data/lib/mutant/meta/example.rb +2 -116
- data/lib/mutant/meta/example/dsl.rb +22 -19
- data/lib/mutant/meta/example/verification.rb +86 -0
- data/lib/mutant/mutator.rb +22 -49
- data/lib/mutant/mutator/node.rb +15 -19
- data/lib/mutant/mutator/node/and_asgn.rb +1 -1
- data/lib/mutant/mutator/node/argument.rb +10 -5
- data/lib/mutant/mutator/node/arguments.rb +5 -9
- data/lib/mutant/mutator/node/begin.rb +4 -17
- data/lib/mutant/mutator/node/block.rb +1 -1
- data/lib/mutant/mutator/node/break.rb +1 -1
- data/lib/mutant/mutator/node/class.rb +21 -0
- data/lib/mutant/mutator/node/conditional_loop.rb +1 -1
- data/lib/mutant/mutator/node/define.rb +1 -1
- data/lib/mutant/mutator/node/defined.rb +1 -1
- data/lib/mutant/mutator/node/dstr.rb +1 -1
- data/lib/mutant/mutator/node/dsym.rb +1 -1
- data/lib/mutant/mutator/node/generic.rb +3 -3
- data/lib/mutant/mutator/node/kwbegin.rb +1 -1
- data/lib/mutant/mutator/node/literal.rb +9 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +1 -1
- data/lib/mutant/mutator/node/literal/fixnum.rb +2 -2
- data/lib/mutant/mutator/node/literal/float.rb +4 -6
- data/lib/mutant/mutator/node/literal/hash.rb +1 -1
- data/lib/mutant/mutator/node/literal/nil.rb +1 -1
- data/lib/mutant/mutator/node/literal/range.rb +2 -19
- data/lib/mutant/mutator/node/literal/regex.rb +43 -3
- data/lib/mutant/mutator/node/literal/string.rb +1 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +2 -4
- data/lib/mutant/mutator/node/masgn.rb +1 -1
- data/lib/mutant/mutator/node/match_current_line.rb +1 -1
- data/lib/mutant/mutator/node/mlhs.rb +2 -3
- data/lib/mutant/mutator/node/named_value/access.rb +2 -2
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +4 -3
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +4 -4
- data/lib/mutant/mutator/node/next.rb +1 -1
- data/lib/mutant/mutator/node/nthref.rb +1 -1
- data/lib/mutant/mutator/node/or_asgn.rb +1 -1
- data/lib/mutant/mutator/node/regexp.rb +44 -0
- data/lib/mutant/mutator/node/regopt.rb +31 -0
- data/lib/mutant/mutator/node/resbody.rb +1 -1
- data/lib/mutant/mutator/node/rescue.rb +1 -3
- data/lib/mutant/mutator/node/return.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +43 -3
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +4 -1
- data/lib/mutant/mutator/node/send/conditional.rb +23 -0
- data/lib/mutant/mutator/node/send/index.rb +1 -1
- data/lib/mutant/mutator/node/splat.rb +1 -1
- data/lib/mutant/mutator/node/when.rb +1 -1
- data/lib/mutant/mutator/node/yield.rb +1 -1
- data/lib/mutant/mutator/util.rb +0 -30
- data/lib/mutant/mutator/util/array.rb +4 -16
- data/lib/mutant/parallel.rb +1 -1
- data/lib/mutant/parallel/worker.rb +1 -1
- data/lib/mutant/registry.rb +44 -0
- data/lib/mutant/reporter/cli/format.rb +2 -0
- data/lib/mutant/reporter/cli/printer.rb +2 -2
- data/lib/mutant/reporter/cli/printer/config.rb +0 -1
- data/lib/mutant/reporter/cli/printer/env_progress.rb +1 -11
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +1 -1
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -0
- data/lib/mutant/reporter/cli/tput.rb +1 -1
- data/lib/mutant/reporter/sequence.rb +3 -0
- data/lib/mutant/require_highjack.rb +6 -2
- data/lib/mutant/result.rb +1 -1
- data/lib/mutant/subject.rb +5 -5
- data/lib/mutant/subject/method/instance.rb +1 -2
- data/lib/mutant/util.rb +18 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/zombifier.rb +5 -3
- data/meta/and.rb +1 -1
- data/meta/and_asgn.rb +1 -1
- data/meta/array.rb +2 -2
- data/meta/begin.rb +2 -2
- data/meta/block.rb +7 -7
- data/meta/block_pass.rb +1 -1
- data/meta/blockarg.rb +1 -1
- data/meta/break.rb +1 -1
- data/meta/case.rb +2 -2
- data/meta/casgn.rb +11 -2
- data/meta/cbase.rb +1 -1
- data/meta/class.rb +10 -0
- data/meta/const.rb +9 -1
- data/meta/csend.rb +8 -0
- data/meta/cvar.rb +1 -1
- data/meta/cvasgn.rb +1 -1
- data/meta/date.rb +4 -4
- data/meta/def.rb +14 -14
- data/meta/defined.rb +1 -1
- data/meta/dstr.rb +1 -1
- data/meta/dsym.rb +1 -1
- data/meta/ensure.rb +1 -1
- data/meta/false.rb +1 -1
- data/meta/float.rb +3 -3
- data/meta/gvar.rb +1 -1
- data/meta/gvasgn.rb +1 -1
- data/meta/hash.rb +1 -1
- data/meta/if.rb +17 -3
- data/meta/int.rb +1 -1
- data/meta/ivar.rb +1 -1
- data/meta/ivasgn.rb +14 -1
- data/meta/kwarg.rb +8 -0
- data/meta/kwbegin.rb +1 -1
- data/meta/kwoptarg.rb +11 -0
- data/meta/lvar.rb +1 -1
- data/meta/lvasgn.rb +1 -1
- data/meta/masgn.rb +1 -1
- data/meta/match_current_line.rb +2 -2
- data/meta/next.rb +1 -1
- data/meta/nil.rb +1 -1
- data/meta/nthref.rb +5 -5
- data/meta/op_assgn.rb +1 -1
- data/meta/or.rb +1 -1
- data/meta/or_asgn.rb +5 -5
- data/meta/range.rb +2 -8
- data/meta/redo.rb +1 -1
- data/meta/regexp.rb +106 -0
- data/meta/regexp/regexp_bol_anchor.rb +13 -0
- data/meta/regexp/regexp_bos_anchor.rb +26 -0
- data/meta/regexp/regexp_root_expression.rb +13 -0
- data/meta/regopt.rb +8 -0
- data/meta/rescue.rb +49 -4
- data/meta/restarg.rb +6 -9
- data/meta/return.rb +2 -2
- data/meta/self.rb +1 -1
- data/meta/send.rb +228 -55
- data/meta/str.rb +1 -1
- data/meta/super.rb +3 -3
- data/meta/{symbol.rb → sym.rb} +1 -1
- data/meta/true.rb +1 -1
- data/meta/until.rb +1 -1
- data/meta/while.rb +2 -2
- data/meta/yield.rb +1 -1
- data/mutant-rspec.gemspec +2 -2
- data/mutant.gemspec +6 -5
- data/spec/integration/mutant/isolation/fork_spec.rb +8 -0
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integration/mutant/test_mutator_handles_types_spec.rb +1 -2
- data/spec/integrations.yml +93 -24
- data/spec/spec_helper.rb +12 -7
- data/spec/support/compress_helper.rb +1 -1
- data/spec/support/corpus.rb +115 -50
- data/spec/support/fake_actor.rb +5 -5
- data/spec/support/file_system.rb +1 -1
- data/spec/support/ice_nine_config.rb +3 -3
- data/spec/support/ruby_vm.rb +11 -12
- data/spec/support/shared_context.rb +22 -13
- data/spec/support/test_app.rb +1 -1
- data/spec/support/warning.rb +64 -0
- data/spec/support/warnings.yml +4 -0
- data/spec/support/xspec.rb +177 -0
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/sender_spec.rb +1 -1
- data/spec/unit/mutant/ast/meta/send_spec.rb +1 -1
- data/spec/unit/mutant/ast/named_children_spec.rb +26 -0
- data/spec/unit/mutant/ast/regexp/parse_spec.rb +7 -0
- data/spec/unit/mutant/ast/regexp/supported_predicate_spec.rb +14 -0
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +19 -0
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +33 -0
- data/spec/unit/mutant/ast/regexp/transformer_spec.rb +19 -0
- data/spec/unit/mutant/ast/regexp_spec.rb +617 -0
- data/spec/unit/mutant/cli_spec.rb +7 -45
- data/spec/unit/mutant/context_spec.rb +4 -7
- data/spec/unit/mutant/env/{boostrap_spec.rb → bootstrap_spec.rb} +2 -2
- data/spec/unit/mutant/env_spec.rb +13 -16
- data/spec/unit/mutant/expression/namespace/{flat_spec.rb → exact_spec.rb} +0 -0
- data/spec/unit/mutant/integration/rspec_spec.rb +2 -2
- data/spec/unit/mutant/integration_spec.rb +14 -0
- data/spec/unit/mutant/isolation/fork_spec.rb +155 -0
- data/spec/unit/mutant/isolation/none_spec.rb +16 -0
- data/spec/unit/mutant/loader_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/instance_spec.rb +2 -4
- data/spec/unit/mutant/meta/example/dsl_spec.rb +106 -0
- data/spec/unit/mutant/meta/example/verification_spec.rb +120 -0
- data/spec/unit/mutant/meta/example_spec.rb +32 -0
- data/spec/unit/mutant/mutator/node_spec.rb +37 -4
- data/spec/unit/mutant/mutator_spec.rb +21 -0
- data/spec/unit/mutant/{runner → parallel}/driver_spec.rb +0 -0
- data/spec/unit/mutant/parallel/master_spec.rb +13 -13
- data/spec/unit/mutant/registry_spec.rb +47 -0
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +0 -4
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +0 -8
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +0 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +0 -8
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -34
- data/spec/unit/mutant/reporter/cli_spec.rb +0 -22
- data/spec/unit/mutant/repository/diff_spec.rb +6 -6
- data/spec/unit/mutant/require_highjack_spec.rb +38 -14
- data/spec/unit/mutant/result/env_spec.rb +1 -4
- data/spec/unit/mutant/runner_spec.rb +1 -1
- data/spec/unit/mutant/subject/method/instance_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +3 -3
- data/spec/unit/mutant/util/one_spec.rb +20 -0
- data/spec/unit/mutant/zombifier_spec.rb +18 -18
- data/test_app/{Gemfile.rspec3.3 → Gemfile.rspec3.5} +2 -2
- metadata +94 -24
- data/TODO +0 -21
- data/lib/mutant/mutator/node/blockarg.rb +0 -13
- data/lib/mutant/mutator/node/restarg.rb +0 -13
- data/lib/mutant/mutator/registry.rb +0 -49
- data/meta/boolean.rb +0 -13
- data/meta/regex.rb +0 -19
- data/spec/unit/mutant/isolation_spec.rb +0 -104
- data/spec/unit/mutant/mutator/registry_spec.rb +0 -57
data/lib/mutant/mutator/node.rb
CHANGED
@@ -20,11 +20,11 @@ module Mutant
|
|
20
20
|
def self.define_named_child(name, index)
|
21
21
|
super
|
22
22
|
|
23
|
-
define_method("emit_#{name}_mutations") do |&block|
|
23
|
+
define_method(:"emit_#{name}_mutations") do |&block|
|
24
24
|
mutate_child(index, &block)
|
25
25
|
end
|
26
26
|
|
27
|
-
define_method("emit_#{name}") do |node|
|
27
|
+
define_method(:"emit_#{name}") do |node|
|
28
28
|
emit_child_update(index, node)
|
29
29
|
end
|
30
30
|
end
|
@@ -54,10 +54,9 @@ module Mutant
|
|
54
54
|
# @param [Fixnum] index
|
55
55
|
#
|
56
56
|
# @return [undefined]
|
57
|
-
def mutate_child(index,
|
57
|
+
def mutate_child(index, &block)
|
58
58
|
block ||= TAUTOLOGY
|
59
|
-
|
60
|
-
mutator.each(child, self) do |mutation|
|
59
|
+
Mutator.mutate(children.fetch(index), self).each do |mutation|
|
61
60
|
next unless block.call(mutation)
|
62
61
|
emit_child_update(index, mutation)
|
63
62
|
end
|
@@ -117,17 +116,6 @@ module Mutant
|
|
117
116
|
emit(N_NIL) unless asgn_left?
|
118
117
|
end
|
119
118
|
|
120
|
-
# Emit values
|
121
|
-
#
|
122
|
-
# @param [Array<Object>] values
|
123
|
-
#
|
124
|
-
# @return [undefined]
|
125
|
-
def emit_values(values)
|
126
|
-
values.each do |value|
|
127
|
-
emit_type(value)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
119
|
# Parent node
|
132
120
|
#
|
133
121
|
# @return [Parser::AST::Node] node
|
@@ -163,9 +151,17 @@ module Mutant
|
|
163
151
|
#
|
164
152
|
# @return [Enumerable<Fixnum>]
|
165
153
|
def children_indices(range)
|
166
|
-
|
167
|
-
|
168
|
-
|
154
|
+
range.begin.upto(children.length + range.end)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Emit single child mutation
|
158
|
+
#
|
159
|
+
# @return [undefined]
|
160
|
+
def mutate_single_child
|
161
|
+
children.each_with_index do |child, index|
|
162
|
+
mutate_child(index)
|
163
|
+
yield child, index unless children.one?
|
164
|
+
end
|
169
165
|
end
|
170
166
|
|
171
167
|
end # Node
|
@@ -4,7 +4,7 @@ module Mutant
|
|
4
4
|
|
5
5
|
# Mutator for required arguments
|
6
6
|
class Argument < self
|
7
|
-
handle(:arg)
|
7
|
+
handle(:arg, :kwarg)
|
8
8
|
|
9
9
|
UNDERSCORE = '_'.freeze
|
10
10
|
|
@@ -12,7 +12,7 @@ module Mutant
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
#
|
15
|
+
# Emit mutations
|
16
16
|
#
|
17
17
|
# @return [undefined]
|
18
18
|
def dispatch
|
@@ -37,13 +37,18 @@ module Mutant
|
|
37
37
|
# Mutator for optional arguments
|
38
38
|
class Optional < self
|
39
39
|
|
40
|
-
|
40
|
+
TYPE_MAP = IceNine.deep_freeze(
|
41
|
+
optarg: :arg,
|
42
|
+
kwoptarg: :kwarg
|
43
|
+
)
|
44
|
+
|
45
|
+
handle(:optarg, :kwoptarg)
|
41
46
|
|
42
47
|
children :name, :default
|
43
48
|
|
44
49
|
private
|
45
50
|
|
46
|
-
#
|
51
|
+
# Emit mutations
|
47
52
|
#
|
48
53
|
# @return [undefined]
|
49
54
|
def dispatch
|
@@ -56,7 +61,7 @@ module Mutant
|
|
56
61
|
#
|
57
62
|
# @return [undefined]
|
58
63
|
def emit_required_mutation
|
59
|
-
emit(s(
|
64
|
+
emit(s(TYPE_MAP.fetch(node.type), name))
|
60
65
|
end
|
61
66
|
|
62
67
|
end # Optional
|
@@ -8,7 +8,7 @@ module Mutant
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
#
|
11
|
+
# Emit mutations
|
12
12
|
#
|
13
13
|
# @return [undefined]
|
14
14
|
def dispatch
|
@@ -22,7 +22,7 @@ module Mutant
|
|
22
22
|
# @return [undefined]
|
23
23
|
def emit_argument_presence
|
24
24
|
emit_type
|
25
|
-
|
25
|
+
Util::Array::Presence.call(children).each do |children|
|
26
26
|
emit_type(*children)
|
27
27
|
end
|
28
28
|
end
|
@@ -32,7 +32,7 @@ module Mutant
|
|
32
32
|
# @return [undefined]
|
33
33
|
def emit_argument_mutations
|
34
34
|
children.each_with_index do |child, index|
|
35
|
-
Mutator.
|
35
|
+
Mutator.mutate(child).each do |mutant|
|
36
36
|
next if invalid_argument_replacement?(mutant, index)
|
37
37
|
emit_child_update(index, mutant)
|
38
38
|
end
|
@@ -45,11 +45,7 @@ module Mutant
|
|
45
45
|
#
|
46
46
|
# @return [Boolean]
|
47
47
|
def invalid_argument_replacement?(mutant, index)
|
48
|
-
|
49
|
-
|
50
|
-
n_optarg?(original) &&
|
51
|
-
n_arg?(mutant) &&
|
52
|
-
children[0...index].any?(&method(:n_optarg?))
|
48
|
+
n_arg?(mutant) && children[0...index].any?(&method(:n_optarg?))
|
53
49
|
end
|
54
50
|
|
55
51
|
# Emit mlhs expansions
|
@@ -59,7 +55,7 @@ module Mutant
|
|
59
55
|
mlhs_childs_with_index.each do |child, index|
|
60
56
|
dup_children = children.dup
|
61
57
|
dup_children.delete_at(index)
|
62
|
-
dup_children.insert(index, *child
|
58
|
+
dup_children.insert(index, *child)
|
63
59
|
emit_type(*dup_children)
|
64
60
|
end
|
65
61
|
end
|
@@ -9,28 +9,15 @@ module Mutant
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
# Emit
|
12
|
+
# Emit mutations
|
13
13
|
#
|
14
14
|
# @return [undefined]
|
15
15
|
def dispatch
|
16
|
-
|
17
|
-
|
18
|
-
mutate_child(index)
|
19
|
-
emit(child) unless children.eql?([child])
|
16
|
+
mutate_single_child do |child|
|
17
|
+
emit(child)
|
20
18
|
end
|
21
19
|
end
|
22
|
-
|
23
|
-
# Emit child subset
|
24
|
-
#
|
25
|
-
# @param [Array<Parser::AST::Node>] children
|
26
|
-
#
|
27
|
-
# @return [undefined]
|
28
|
-
def emit_child_subset(children)
|
29
|
-
return if children.length < 2
|
30
|
-
emit_type(*children)
|
31
|
-
end
|
32
|
-
|
33
|
-
end # Block
|
20
|
+
end # Begin
|
34
21
|
end # Node
|
35
22
|
end # Mutator
|
36
23
|
end # Mutant
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Mutant
|
2
|
+
class Mutator
|
3
|
+
class Node
|
4
|
+
# Namespace for class mutations
|
5
|
+
class Class < self
|
6
|
+
handle :class
|
7
|
+
|
8
|
+
children :klass, :parent, :body
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# Emit mutations only for class body
|
13
|
+
#
|
14
|
+
# @return [undefined]
|
15
|
+
def dispatch
|
16
|
+
emit_body_mutations if body
|
17
|
+
end
|
18
|
+
end # Class
|
19
|
+
end # Node
|
20
|
+
end # Mutator
|
21
|
+
end # Mutant
|
@@ -8,9 +8,9 @@ module Mutant
|
|
8
8
|
# These nodes still need a dedicated mutator,
|
9
9
|
# your contribution is that close!
|
10
10
|
handle(
|
11
|
-
:
|
12
|
-
:kwrestarg, :
|
13
|
-
:alias, :for, :xstr, :back_ref, :
|
11
|
+
:ensure, :redo, :retry, :arg_expr, :blockarg,
|
12
|
+
:kwrestarg, :undef, :module, :empty,
|
13
|
+
:alias, :for, :xstr, :back_ref, :restarg,
|
14
14
|
:sclass, :match_with_lvasgn, :while_post,
|
15
15
|
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
|
16
16
|
:shadowarg, :rational, :complex, :__FILE__, :__LINE__
|
@@ -4,6 +4,15 @@ module Mutant
|
|
4
4
|
# Abstract mutator for literal AST nodes
|
5
5
|
class Literal < self
|
6
6
|
include AbstractType
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
# Emit values
|
11
|
+
#
|
12
|
+
# @return [undefined]
|
13
|
+
def emit_values
|
14
|
+
values.each(&method(:emit_type))
|
15
|
+
end
|
7
16
|
end # Literal
|
8
17
|
end # Node
|
9
18
|
end # Mutator
|
@@ -9,12 +9,12 @@ module Mutant
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
# Emit
|
12
|
+
# Emit mutations
|
13
13
|
#
|
14
14
|
# @return [undefined]
|
15
15
|
def dispatch
|
16
16
|
emit_singletons
|
17
|
-
emit_values
|
17
|
+
emit_values
|
18
18
|
emit_special_cases
|
19
19
|
end
|
20
20
|
|
@@ -36,10 +36,8 @@ module Mutant
|
|
36
36
|
# @return [Array]
|
37
37
|
def values
|
38
38
|
original = children.first
|
39
|
-
|
40
|
-
[0.0, 1.0, -original]
|
41
|
-
value.eql?(original)
|
42
|
-
end
|
39
|
+
|
40
|
+
[0.0, 1.0, -original]
|
43
41
|
end
|
44
42
|
|
45
43
|
end # Float
|
@@ -11,13 +11,13 @@ module Mutant
|
|
11
11
|
erange: :irange
|
12
12
|
}.freeze
|
13
13
|
|
14
|
-
children :
|
14
|
+
children :lower_bound, :upper_bound
|
15
15
|
|
16
16
|
handle(*MAP.keys)
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
|
-
# Emit
|
20
|
+
# Emit mutations
|
21
21
|
#
|
22
22
|
# @return [undefined]
|
23
23
|
def dispatch
|
@@ -34,23 +34,6 @@ module Mutant
|
|
34
34
|
emit(s(MAP.fetch(node.type), *children))
|
35
35
|
end
|
36
36
|
|
37
|
-
# Emit range start mutations
|
38
|
-
#
|
39
|
-
# @return [undefined]
|
40
|
-
def emit_upper_bound_mutations
|
41
|
-
emit__end_mutations
|
42
|
-
emit_type(N_NAN, _end)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Emit start mutations
|
46
|
-
#
|
47
|
-
# @return [undefined]
|
48
|
-
def emit_lower_bound_mutations
|
49
|
-
emit_start_mutations
|
50
|
-
emit_type(start, N_INFINITY)
|
51
|
-
emit_type(start, N_NAN)
|
52
|
-
end
|
53
|
-
|
54
37
|
end # Range
|
55
38
|
end # Literal
|
56
39
|
end # Node
|