Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/gecoder/interface/constraints/int/channel.rb | 51 | 33 | 100.00%
|
100.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 module Gecode::Int |
2 class IntConstraintReceiver |
3 alias_method :pre_channel_equals, :== |
4 |
5 # Constrains the integer operand to be equal to the specified boolean |
6 # operand. I.e. constrains the integer operand to be 1 when the boolean |
7 # operand is true and 0 if the boolean operand is false. |
8 # |
9 # ==== Examples |
10 # |
11 # # The integer operand +int+ must be one exactly when the boolean |
12 # # operand +bool+ is true. |
13 # int.must == bool |
14 def ==(bool, options = {}) |
15 unless @params[:lhs].respond_to? :to_int_var and |
16 bool.respond_to? :to_bool_var |
17 return pre_channel_equals(bool, options) |
18 end |
19 |
20 if @params[:negate] |
21 raise Gecode::MissingConstraintError, 'A negated channel constraint ' + |
22 'is not implemented.' |
23 end |
24 unless options[:reify].nil? |
25 raise ArgumentError, 'Reification is not supported by the channel ' + |
26 'constraint.' |
27 end |
28 |
29 @params.update(Gecode::Util.decode_options(options)) |
30 @params[:rhs] = bool |
31 @model.add_constraint Channel::ChannelConstraint.new(@model, @params) |
32 end |
33 |
34 alias_comparison_methods |
35 |
36 # Provides commutativity with BoolEnumConstraintReceiver#channel . |
37 provide_commutativity(:channel){ |rhs, _| rhs.respond_to? :to_bool_enum } |
38 end |
39 |
40 # A module that gathers the classes and modules used in channel constraints |
41 # involving a single integer operand. |
42 module Channel #:nodoc: |
43 class ChannelConstraint < Gecode::Constraint #:nodoc: |
44 def post |
45 lhs, rhs = @params.values_at(:lhs, :rhs) |
46 Gecode::Raw::channel(@model.active_space, lhs.to_int_var.bind, |
47 rhs.to_bool_var.bind, *propagation_options) |
48 end |
49 end |
50 end |
51 end |
Generated on Thu Jan 08 13:27:03 +0100 2015 with rcov 1.0.0