Generated on for Gecode by doxygen 1.17.0
flatzinc.hh
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.dev>
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.dev
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#ifndef GECODE_TEST_FLATZINC_HH
35#define GECODE_TEST_FLATZINC_HH
36
37#include <gecode/kernel.hh>
38#include <gecode/flatzinc.hh>
39
40#include "test/test.hh"
41
42#include <functional>
43#include <string>
44#include <vector>
45
46namespace Test {
47
49 namespace FlatZinc {
50
55 class FlatZincTest : public Base {
56 protected:
57 typedef std::function<bool(const std::string&)> OutputCheck;
58 typedef std::function<void(void)> BeforeRun;
59 std::string _name;
60 std::string _source;
61 std::string _expected;
63 std::vector<std::string> _cmdlineOpt;
66 public:
68 FlatZincTest(const std::string& name, const std::string& source,
69 const std::string& expected, bool allSolutions = false,
70 std::vector<std::string> cmdlineOpt = {},
71 OutputCheck check = OutputCheck(),
72 BeforeRun before = BeforeRun());
74 virtual bool run(void);
75 };
76
78 private:
79 std::string _expectedMessage;
80 public:
82 FlatZincErrorTest(const std::string& name, const std::string& source,
83 std::vector<std::string> cmdlineOpt = {},
84 std::string expectedMessage = "");
86 virtual bool run(void);
87 };
88
89 }
90
91}
92
93#endif
94
95// STATISTICS: test-flatzinc
Base(std::string s)
Create and register test with name s.
const std::string & name(void) const
Return name of test.
Definition test.hpp:51
virtual bool run(void)
Perform test.
FlatZincErrorTest(const std::string &name, const std::string &source, std::vector< std::string > cmdlineOpt={}, std::string expectedMessage="")
Construct and register test.
FlatZincTest(const std::string &name, const std::string &source, const std::string &expected, bool allSolutions=false, std::vector< std::string > cmdlineOpt={}, OutputCheck check=OutputCheck(), BeforeRun before=BeforeRun())
Construct and register test.
std::function< void(void)> BeforeRun
Definition flatzinc.hh:58
std::vector< std::string > _cmdlineOpt
Definition flatzinc.hh:63
std::function< bool(const std::string &)> OutputCheck
Definition flatzinc.hh:57
virtual bool run(void)
Perform test.
Tests for FlatZinc.
Definition flatzinc.hh:49
General test support.
Definition assign.hh:52