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