File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818^^^^^
1919- Close generated solver configuration before handing it to MiniZinc. This fixes the
2020 usage of generated solver configurations on Windows.
21+ - The DZN parser now constructs correct range objects. The parser was off by one due to
22+ the exclusive upper bound in Python range objects.
2123
22240.2.2 _ - 2020-02-17
2325-------------------
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ def set(s):
7171 if len (s ) == 1 :
7272 return set (s [0 ])
7373 else :
74- return range (s [0 ], s [1 ])
74+ return range (s [0 ], s [1 ] + 1 )
7575
7676 @staticmethod
7777 def string (s ):
Original file line number Diff line number Diff line change @@ -51,8 +51,11 @@ def test_dzn_set():
5151 assert parse_dzn ("x = {1.2,2.1}" ) == {"x" : {1.2 , 2.1 }}
5252
5353 # Set Ranges
54- assert parse_dzn ("x = 1..1" ) == {"x" : range (1 , 1 )}
55- assert parse_dzn ("x = 1..3" ) == {"x" : range (1 , 3 )}
54+ # note: upper range limit is exclusive in Python
55+ assert parse_dzn ("x = 1..1" ) == {"x" : range (1 , 2 )}
56+ assert set (parse_dzn ("x = 1..1" )["x" ]) == {1 }
57+ assert parse_dzn ("x = 1..3" ) == {"x" : range (1 , 4 )}
58+ assert set (parse_dzn ("x = 1..3" )["x" ]) == {1 , 2 , 3 }
5659
5760
5861def test_dzn_array ():
You can’t perform that action at this time.
0 commit comments