main page
modules
namespaces
classes
files
Gecode home
Generated on Mon Jul 27 2020 00:00:00 for Gecode by
doxygen
1.8.18
test
test.hh
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Christian Schulte <schulte@gecode.org>
5
*
6
* Contributing authors:
7
* Mikael Lagerkvist <lagerkvist@gecode.org>
8
*
9
* Copyright:
10
* Christian Schulte, 2005
11
* Mikael Lagerkvist, 2005
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
#ifndef __GECODE_TEST_TEST_HH__
39
#define __GECODE_TEST_TEST_HH__
40
41
#include <
gecode/kernel.hh
>
42
#include <
gecode/search.hh
>
43
44
#include <iostream>
45
#include <sstream>
46
#include <string>
47
49
namespace
Test
{
50
63
extern
std::ostringstream
olog
;
64
66
class
ind
{
67
public
:
69
int
l
;
71
ind
(
int
i
) :
l
(
i
) {}
72
};
73
74
76
class
Options
{
77
public
:
79
unsigned
int
seed
;
81
unsigned
int
iter
;
83
static
const
int
defiter
= 5;
85
unsigned
int
fixprob
;
87
static
const
unsigned
int
deffixprob
= 10;
89
bool
stop
;
91
bool
log
;
92
94
Options
(
void
);
96
void
parse
(
int
argc,
char
* argv[]);
97
};
98
100
extern
Options
opt
;
101
103
class
Base
{
104
private
:
106
std::string _name;
108
Base
* _next;
110
static
Base
* _tests;
112
static
unsigned
int
_n_tests;
113
public
:
115
Base
(
const
std::string& s);
117
static
void
sort
(
void
);
119
const
std::string&
name
(
void
)
const
;
121
static
Base
*
tests
(
void
);
123
Base
*
next
(
void
)
const
;
125
void
next
(
Base
*
n
);
127
virtual
bool
run
(
void
) = 0;
129
static
bool
fixpoint
(
void
);
131
virtual
~Base
(
void
);
132
134
static
Gecode::Support::RandomGenerator
rand
;
135
};
137
138
}
139
144
int
main
(
int
argc,
char
* argv[]);
145
150
std::ostream&
151
operator<<
(std::ostream& os,
const
Test::ind
&
i
);
152
153
#include "
test/test.hpp
"
154
155
#endif
156
157
// STATISTICS: test-core
kernel.hh
AllInterval::main
int main(int argc, char *argv[])
Main-function.
Definition:
all-interval.cpp:117
Test::Base::sort
static void sort(void)
Sort tests alphabetically.
Definition:
test.cpp:77
search.hh
Test::Base::tests
static Base * tests(void)
Return all tests.
Definition:
test.hpp:54
Test::Base::name
const std::string & name(void) const
Return name of test.
Definition:
test.hpp:50
Test::Base::rand
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition:
test.hh:134
Test::Options::iter
unsigned int iter
Number of iterations for each test.
Definition:
test.hh:81
Test::Options::Options
Options(void)
Initialize options with defaults.
Definition:
test.hpp:41
Test::Base
Base class for all tests to be run
Definition:
test.hh:103
Gecode::Float::FloatView::operator<<
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatView &x)
Print float variable view.
Test::opt
Options opt
The options.
Definition:
test.cpp:97
Test::Options::defiter
static const int defiter
Default number of iterations.
Definition:
test.hh:83
Test::Options::log
bool log
Whether to log the tests.
Definition:
test.hh:91
Test::Options::deffixprob
static const unsigned int deffixprob
Default fixpoint probaibility.
Definition:
test.hh:87
Gecode::Support::LinearCongruentialGenerator
Template for linear congruential generators.
Definition:
random.hpp:46
Test::Base::run
virtual bool run(void)=0
Run test.
Test::ind::ind
ind(int i)
Indent by level i.
Definition:
test.hh:71
Test::Options::fixprob
unsigned int fixprob
The probability for computing a fixpoint.
Definition:
test.hh:85
Test::Base::fixpoint
static bool fixpoint(void)
Throw a coin whether to compute a fixpoint.
Definition:
test.hpp:66
test.hpp
Test::Base::next
Base * next(void) const
Return next test.
Definition:
test.hpp:58
Test::Options
Commandline options.
Definition:
test.hh:76
Test::ind
Simple class for describing identation.
Definition:
test.hh:66
Test
General test support.
Definition:
afc.cpp:39
Test::Options::parse
void parse(int argc, char *argv[])
Parse commandline arguments.
Definition:
test.cpp:120
Test::Base::~Base
virtual ~Base(void)
Destructor.
Definition:
test.cpp:92
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234
Test::Int::Basic::i
Gecode::IntArgs i({1, 2, 3, 4})
Test::olog
std::ostringstream olog
Stream used for logging.
Definition:
test.cpp:53
Test::ind::l
int l
Which indentation level.
Definition:
test.hh:69
Test::Base::Base
Base(const std::string &s)
Create and register test with name s.
Definition:
test.cpp:59
Test::Options::seed
unsigned int seed
The random seed to be used.
Definition:
test.hh:79
Test::Options::stop
bool stop
Whether to stop on an error.
Definition:
test.hh:89