gecoder-with-gecode 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/CHANGES +14 -0
  2. data/ext/gecoder.cpp +181 -0
  3. data/ext/gecoder.h +94 -0
  4. data/ext/vararray.cpp +3 -3
  5. data/lib/gecoder/bindings/bindings.rb +104 -46
  6. data/lib/gecoder/interface/binding_changes.rb +1 -301
  7. data/lib/gecoder/interface/branch.rb +15 -11
  8. data/lib/gecoder/interface/constraints.rb +38 -0
  9. data/lib/gecoder/interface/constraints/bool/boolean.rb +56 -52
  10. data/lib/gecoder/interface/constraints/bool/channel.rb +1 -16
  11. data/lib/gecoder/interface/constraints/bool_enum/channel.rb +13 -8
  12. data/lib/gecoder/interface/constraints/bool_enum/extensional.rb +48 -0
  13. data/lib/gecoder/interface/constraints/extensional_regexp.rb +101 -0
  14. data/lib/gecoder/interface/constraints/int/channel.rb +1 -13
  15. data/lib/gecoder/interface/constraints/int_enum/channel.rb +15 -35
  16. data/lib/gecoder/interface/constraints/int_enum/extensional.rb +130 -0
  17. data/lib/gecoder/interface/constraints/set/channel.rb +54 -0
  18. data/lib/gecoder/interface/constraints/set_enum/channel.rb +37 -6
  19. data/lib/gecoder/interface/constraints/set_var_constraints.rb +1 -0
  20. data/lib/gecoder/interface/model.rb +110 -85
  21. data/lib/gecoder/interface/variables.rb +3 -21
  22. data/lib/gecoder/version.rb +1 -1
  23. data/specs/branch.rb +16 -1
  24. data/specs/constraints/bool_enum_relation.rb +6 -6
  25. data/specs/constraints/boolean.rb +31 -25
  26. data/specs/constraints/channel.rb +102 -4
  27. data/specs/constraints/extensional.rb +185 -2
  28. data/specs/constraints/reification_sugar.rb +2 -46
  29. data/specs/model.rb +85 -7
  30. data/tasks/dependencies.txt +1 -0
  31. data/vendor/rust/rust/class.rb +33 -35
  32. data/vendor/rust/rust/templates/ClassDeclarations.rusttpl +1 -1
  33. data/vendor/rust/rust/templates/CxxClassDefinitions.rusttpl +10 -1
  34. metadata +707 -706
  35. data/example/raw_bindings.rb +0 -44
  36. data/ext/missing.cpp +0 -328
  37. data/ext/missing.h +0 -120
  38. data/specs/binding_changes.rb +0 -76
@@ -1,76 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- describe 'Space', :shared => true do
4
- it 'should give different indices when creating int variables' do
5
- @space.new_int_vars([0, 17]).should_not equal(@space.new_int_vars([0, 17]))
6
- end
7
-
8
- it 'should give different indices when creating bool variables' do
9
- @space.new_bool_vars().should_not equal(@space.new_bool_vars())
10
- end
11
-
12
- it 'should give different indices when creating multiple int variables' do
13
- @space.new_int_vars([0, 17], 17).uniq.size.should equal(17)
14
- end
15
-
16
- it 'should give different indices when creating multiple bool variables' do
17
- @space.new_bool_vars(17).uniq.size.should equal(17)
18
- end
19
-
20
- it 'should not return nil for created int variables' do
21
- @space.new_int_vars([0, 17], 4).each do |i|
22
- @space.int_var(i).should_not be_nil
23
- end
24
- end
25
-
26
- it 'should not return nil for created int variables' do
27
- @space.new_bool_vars(4).each do |i|
28
- @space.bool_var(i).should_not be_nil
29
- end
30
- end
31
-
32
- it 'should return nil when requesting int variables with negative indices' do
33
- @space.int_var(-1).should be_nil
34
- end
35
-
36
- it 'should return nil when requesting bool variables with negative indices' do
37
- @space.bool_var(-1).should be_nil
38
- end
39
-
40
- it 'should raise an error if given a domain of incorrect type' do
41
- lambda{ @space.new_int_vars(17) }.should raise_error(TypeError)
42
- end
43
- end
44
-
45
- describe Gecode::Raw::Space, ' (new)' do
46
- before do
47
- @space = Gecode::Raw::Space.new
48
- end
49
-
50
- it 'should return nil when requesting int variables' do
51
- @space.int_var(0).should be_nil
52
- end
53
-
54
- it 'should return nil when requesting bool variables' do
55
- @space.bool_var(0).should be_nil
56
- end
57
-
58
- it_should_behave_like 'Space'
59
- end
60
-
61
- describe Gecode::Raw::Space, ' (with items)' do
62
- before do
63
- @space = Gecode::Raw::Space.new
64
- @first = @space.new_int_vars([1, 4]).first
65
- @second = @space.new_int_vars([-5, 5]).first
66
- end
67
-
68
- it_should_behave_like 'Space'
69
-
70
- it 'should give int variables with the correct domains' do
71
- @space.int_var(@first).min.should equal(1)
72
- @space.int_var(@first).max.should equal(4)
73
- @space.int_var(@second).min.should equal(-5)
74
- @space.int_var(@second).max.should equal(5)
75
- end
76
- end