Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/gecoder/interface/constraints/set/include.rb | 36 | 24 | 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::Set |
2 class SetConstraintReceiver |
3 # Constrains this set to include the values of +int_enum+. |
4 # |
5 # The constraint has the side effect of sorting the integer operands in a |
6 # non-descending order. It does not support reification nor negation. |
7 # |
8 # ==== Examples |
9 # |
10 # # Constrain +set+ to include the values of all operands in |
11 # # +int_enum+. |
12 # set.must.include int_enum |
13 def include(int_enum) |
14 unless int_enum.respond_to? :to_int_enum |
15 raise TypeError, "Expected int var enum, got #{int_enum.class}." |
16 end |
17 if @params[:negate] |
18 raise Gecode::MissingConstraintError, 'A negated include is not ' + |
19 'implemented.' |
20 end |
21 |
22 @params.update(:variables => int_enum) |
23 @model.add_constraint Connection::IncludeConstraint.new(@model, @params) |
24 end |
25 end |
26 |
27 module Connection #:nodoc: |
28 class IncludeConstraint < Gecode::Constraint #:nodoc: |
29 def post |
30 set, variables = @params.values_at(:lhs, :variables) |
31 Gecode::Raw::match(@model.active_space, set.to_set_var.bind, |
32 variables.to_int_enum.bind_array) |
33 end |
34 end |
35 end |
36 end |
Generated on Thu Jan 08 13:27:03 +0100 2015 with rcov 1.0.0