this repo has no description
at develop 4.4 kB view raw
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 36namespace Test { namespace FlatZinc { 37 38 namespace { 39 /// Helper class to create and register tests 40 class Create { 41 public: 42 43 /// Perform creation and registration 44 Create(void) { 45 (void) new FlatZincTest("fzn_logic", 46"var bool: b1 :: output_var;\n\ 47var bool: b2 :: output_var;\n\ 48var bool: b3 :: output_var;\n\ 49var bool: b4 :: output_var;\n\ 50var bool: b5 :: output_var;\n\ 51var bool: b6 :: output_var;\n\ 52array [1..3] of var bool: ab1 :: output_array([1..3]);\n\ 53array [1..3] of var bool: ab2 :: output_array([1..3]);\n\ 54\n\ 55constraint bool_eq(true, true);\n\ 56constraint bool_eq(false, false);\n\ 57\n\ 58constraint bool_not(true, false);\n\ 59constraint bool_not(false, true);\n\ 60\n\ 61constraint bool_and(false, true, false);\n\ 62constraint bool_and(false, false, false);\n\ 63constraint bool_and(true, false, false);\n\ 64constraint bool_and(true, true, true);\n\ 65constraint bool_and(b1, true, true);\n\ 66\n\ 67constraint bool_or(false, true, true);\n\ 68constraint bool_or(false, false, false);\n\ 69constraint bool_or(true, false, true);\n\ 70constraint bool_or(true, true, true);\n\ 71constraint bool_or(b2, false, true);\n\ 72\n\ 73constraint bool_xor(false, true, true);\n\ 74constraint bool_xor(false, false, false);\n\ 75constraint bool_xor(true, false, true);\n\ 76constraint bool_xor(true, true, false);\n\ 77constraint bool_xor(b3, false, true);\n\ 78\n\ 79constraint bool_le_reif(false, true, true);\n\ 80constraint bool_le_reif(false, false, true);\n\ 81constraint bool_le_reif(true, false, false);\n\ 82constraint bool_le_reif(true, true, true);\n\ 83constraint bool_le_reif(true, b4, true);\n\ 84\n\ 85constraint bool_le_reif(false, true, true);\n\ 86constraint bool_le_reif(false, false, true);\n\ 87constraint bool_le_reif(true, false, false);\n\ 88constraint bool_le_reif(true, true, true);\n\ 89constraint bool_le_reif(true, b5, true);\n\ 90\n\ 91constraint bool_not(false, true);\n\ 92constraint bool_not(true, false);\n\ 93constraint bool_not(b6, false);\n\ 94\n\ 95constraint array_bool_and([false], false);\n\ 96constraint array_bool_and([true], true);\n\ 97constraint array_bool_and([false, true], false);\n\ 98constraint array_bool_and([false, false], false);\n\ 99constraint array_bool_and([true, false], false);\n\ 100constraint array_bool_and([true, true], true);\n\ 101constraint array_bool_and(ab1, true);\n\ 102\n\ 103constraint array_bool_or([false], false);\n\ 104constraint array_bool_or([true], true);\n\ 105constraint array_bool_or([false, true], true);\n\ 106constraint array_bool_or([false, false], false);\n\ 107constraint array_bool_or([true, false], true);\n\ 108constraint array_bool_or([true, true], true);\n\ 109constraint array_bool_or(ab2, true);\n\ 110\n\ 111solve satisfy;\n\ 112", 113"ab1 = array1d(1..3, [true, true, true]);\n\ 114ab2 = array1d(1..3, [true, false, false]);\n\ 115b1 = true;\n\ 116b2 = true;\n\ 117b3 = true;\n\ 118b4 = true;\n\ 119b5 = true;\n\ 120b6 = true;\n\ 121----------\n\ 122"); 123 } 124 }; 125 126 Create c; 127 } 128 129}} 130 131// STATISTICS: test-flatzinc