main page
modules
namespaces
classes
files
Gecode home
Generated on Sun Aug 9 2020 05:34:08 for Gecode by
doxygen
1.8.18
test
flatzinc
test_fzn_logic.cpp
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Guido Tack <tack@gecode.org>
5
*
6
* Copyright:
7
* Guido Tack, 2014
8
*
9
* This file is part of Gecode, the generic constraint
10
* development environment:
11
* http://www.gecode.org
12
*
13
* Permission is hereby granted, free of charge, to any person obtaining
14
* a copy of this software and associated documentation files (the
15
* "Software"), to deal in the Software without restriction, including
16
* without limitation the rights to use, copy, modify, merge, publish,
17
* distribute, sublicense, and/or sell copies of the Software, and to
18
* permit persons to whom the Software is furnished to do so, subject to
19
* the following conditions:
20
*
21
* The above copyright notice and this permission notice shall be
22
* included in all copies or substantial portions of the Software.
23
*
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
*
32
*/
33
34
#include "
test/flatzinc.hh
"
35
36
namespace
Test
{
namespace
FlatZinc {
37
38
namespace
{
40
class
Create {
41
public
:
42
44
Create(
void
) {
45
(void)
new
FlatZincTest(
"fzn_logic"
,
46
"var bool: b1 :: output_var;\n\
47
var bool: b2 :: output_var;\n\
48
var bool: b3 :: output_var;\n\
49
var bool: b4 :: output_var;\n\
50
var bool: b5 :: output_var;\n\
51
var bool: b6 :: output_var;\n\
52
array [1..3] of var bool: ab1 :: output_array([1..3]);\n\
53
array [1..3] of var bool: ab2 :: output_array([1..3]);\n\
54
\n\
55
constraint bool_eq(true, true);\n\
56
constraint bool_eq(false, false);\n\
57
\n\
58
constraint bool_not(true, false);\n\
59
constraint bool_not(false, true);\n\
60
\n\
61
constraint bool_and(false, true, false);\n\
62
constraint bool_and(false, false, false);\n\
63
constraint bool_and(true, false, false);\n\
64
constraint bool_and(true, true, true);\n\
65
constraint bool_and(b1, true, true);\n\
66
\n\
67
constraint bool_or(false, true, true);\n\
68
constraint bool_or(false, false, false);\n\
69
constraint bool_or(true, false, true);\n\
70
constraint bool_or(true, true, true);\n\
71
constraint bool_or(b2, false, true);\n\
72
\n\
73
constraint bool_xor(false, true, true);\n\
74
constraint bool_xor(false, false, false);\n\
75
constraint bool_xor(true, false, true);\n\
76
constraint bool_xor(true, true, false);\n\
77
constraint bool_xor(b3, false, true);\n\
78
\n\
79
constraint bool_le_reif(false, true, true);\n\
80
constraint bool_le_reif(false, false, true);\n\
81
constraint bool_le_reif(true, false, false);\n\
82
constraint bool_le_reif(true, true, true);\n\
83
constraint bool_le_reif(true, b4, true);\n\
84
\n\
85
constraint bool_le_reif(false, true, true);\n\
86
constraint bool_le_reif(false, false, true);\n\
87
constraint bool_le_reif(true, false, false);\n\
88
constraint bool_le_reif(true, true, true);\n\
89
constraint bool_le_reif(true, b5, true);\n\
90
\n\
91
constraint bool_not(false, true);\n\
92
constraint bool_not(true, false);\n\
93
constraint bool_not(b6, false);\n\
94
\n\
95
constraint array_bool_and([false], false);\n\
96
constraint array_bool_and([true], true);\n\
97
constraint array_bool_and([false, true], false);\n\
98
constraint array_bool_and([false, false], false);\n\
99
constraint array_bool_and([true, false], false);\n\
100
constraint array_bool_and([true, true], true);\n\
101
constraint array_bool_and(ab1, true);\n\
102
\n\
103
constraint array_bool_or([false], false);\n\
104
constraint array_bool_or([true], true);\n\
105
constraint array_bool_or([false, true], true);\n\
106
constraint array_bool_or([false, false], false);\n\
107
constraint array_bool_or([true, false], true);\n\
108
constraint array_bool_or([true, true], true);\n\
109
constraint array_bool_or(ab2, true);\n\
110
\n\
111
solve satisfy;\n\
112
"
,
113
"ab1 = array1d(1..3, [true, true, true]);\n\
114
ab2 = array1d(1..3, [true, false, false]);\n\
115
b1 = true;\n\
116
b2 = true;\n\
117
b3 = true;\n\
118
b4 = true;\n\
119
b5 = true;\n\
120
b6 = true;\n\
121
----------\n\
122
"
);
123
}
124
};
125
126
Create
c
;
127
}
128
129
}}
130
131
// STATISTICS: test-flatzinc
Test
General test support.
Definition:
afc.cpp:39
Test::Float::Arithmetic::c
Gecode::FloatVal c(-8, 8)
flatzinc.hh