Class: DeepCover::Analyser::Branch

Inherits:
DeepCover::Analyser show all
Includes:
Subset
Defined in:
lib/deep_cover/analyser/branch.rb

Constant Summary collapse

SUBSET_CLASSES =
[Node::Branch].freeze

Instance Attribute Summary

Attributes included from Base

#options, #source

Instance Method Summary collapse

Methods included from Subset

#node_children

Methods included from OptionallyCovered

#optionally_covered

Methods included from IgnoreUncovered

#initialize, #node_runs

Methods included from Base

#covered_code, #each_node, #initialize, #node_children, #node_runs, #node_runs_map

Instance Method Details

#is_trivial_if?(node) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/deep_cover/analyser/branch.rb', line 17

def is_trivial_if?(node)
  parent = node.parent
  parent.is_a?(Node::If) && parent.condition.is_a?(Node::SingletonLiteral)
end

#resultsObject



10
11
12
13
14
15
# File 'lib/deep_cover/analyser/branch.rb', line 10

def results
  each_node.map do |node|
    branches_runs = node.branches.map { |b| [b, node_runs(b)] }.to_h
    [node, branches_runs]
  end.to_h
end