Generated on Thu Apr 11 13:59:21 2019 for Gecode by doxygen 1.6.3

test_fzn_logic.cpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2014
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #include "test/flatzinc.hh"
00035 
00036 namespace Test { namespace FlatZinc {
00037 
00038   namespace {
00040     class Create {
00041     public:
00042 
00044       Create(void) {
00045         (void) new FlatZincTest("fzn_logic",
00046 "var bool: b1 :: output_var;\n\
00047 var bool: b2 :: output_var;\n\
00048 var bool: b3 :: output_var;\n\
00049 var bool: b4 :: output_var;\n\
00050 var bool: b5 :: output_var;\n\
00051 var bool: b6 :: output_var;\n\
00052 array [1..3] of var bool: ab1 :: output_array([1..3]);\n\
00053 array [1..3] of var bool: ab2 :: output_array([1..3]);\n\
00054 \n\
00055 constraint bool_eq(true, true);\n\
00056 constraint bool_eq(false, false);\n\
00057 \n\
00058 constraint bool_not(true, false);\n\
00059 constraint bool_not(false, true);\n\
00060 \n\
00061 constraint bool_and(false, true,  false);\n\
00062 constraint bool_and(false, false, false);\n\
00063 constraint bool_and(true,  false, false);\n\
00064 constraint bool_and(true,  true,  true);\n\
00065 constraint bool_and(b1,    true, true);\n\
00066 \n\
00067 constraint bool_or(false, true,  true);\n\
00068 constraint bool_or(false, false, false);\n\
00069 constraint bool_or(true,  false, true);\n\
00070 constraint bool_or(true,  true,  true);\n\
00071 constraint bool_or(b2,    false, true);\n\
00072 \n\
00073 constraint bool_xor(false, true,  true);\n\
00074 constraint bool_xor(false, false, false);\n\
00075 constraint bool_xor(true,  false, true);\n\
00076 constraint bool_xor(true,  true,  false);\n\
00077 constraint bool_xor(b3,    false, true);\n\
00078 \n\
00079 constraint bool_le_reif(false, true,  true);\n\
00080 constraint bool_le_reif(false, false, true);\n\
00081 constraint bool_le_reif(true,  false, false);\n\
00082 constraint bool_le_reif(true,  true,  true);\n\
00083 constraint bool_le_reif(true,  b4,    true);\n\
00084 \n\
00085 constraint bool_le_reif(false, true, true);\n\
00086 constraint bool_le_reif(false, false, true);\n\
00087 constraint bool_le_reif(true,  false,  false);\n\
00088 constraint bool_le_reif(true,  true,  true);\n\
00089 constraint bool_le_reif(true,  b5,  true);\n\
00090 \n\
00091 constraint bool_not(false, true);\n\
00092 constraint bool_not(true, false);\n\
00093 constraint bool_not(b6, false);\n\
00094 \n\
00095 constraint array_bool_and([false], false);\n\
00096 constraint array_bool_and([true], true);\n\
00097 constraint array_bool_and([false, true],  false);\n\
00098 constraint array_bool_and([false, false], false);\n\
00099 constraint array_bool_and([true,  false], false);\n\
00100 constraint array_bool_and([true,  true],  true);\n\
00101 constraint array_bool_and(ab1, true);\n\
00102 \n\
00103 constraint array_bool_or([false], false);\n\
00104 constraint array_bool_or([true], true);\n\
00105 constraint array_bool_or([false, true],  true);\n\
00106 constraint array_bool_or([false, false], false);\n\
00107 constraint array_bool_or([true,  false], true);\n\
00108 constraint array_bool_or([true,  true],  true);\n\
00109 constraint array_bool_or(ab2, true);\n\
00110 \n\
00111 solve satisfy;\n\
00112 ",
00113 "ab1 = array1d(1..3, [true, true, true]);\n\
00114 ab2 = array1d(1..3, [true, false, false]);\n\
00115 b1 = true;\n\
00116 b2 = true;\n\
00117 b3 = true;\n\
00118 b4 = true;\n\
00119 b5 = true;\n\
00120 b6 = true;\n\
00121 ----------\n\
00122 ");
00123       }
00124     };
00125 
00126     Create c;
00127   }
00128 
00129 }}
00130 
00131 // STATISTICS: test-flatzinc