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
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
* Last modified:
14
* $Date: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $ by $Author: schulte $
15
* $Revision: 10684 $
16
*
17
* This file is part of Gecode, the generic constraint
18
* development environment:
19
* http://www.gecode.org
20
*
21
* Permission is hereby granted, free of charge, to any person obtaining
22
* a copy of this software and associated documentation files (the
23
* "Software"), to deal in the Software without restriction, including
24
* without limitation the rights to use, copy, modify, merge, publish,
25
* distribute, sublicense, and/or sell copies of the Software, and to
26
* permit persons to whom the Software is furnished to do so, subject to
27
* the following conditions:
28
*
29
* The above copyright notice and this permission notice shall be
30
* included in all copies or substantial portions of the Software.
31
*
32
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
*
40
*/
41
42
#ifndef __GECODE_TEST_TEST_HH__
43
#define __GECODE_TEST_TEST_HH__
44
45
#include <
gecode/kernel.hh
>
46
#include <
gecode/search.hh
>
47
48
#include <iostream>
49
#include <sstream>
50
#include <string>
51
53
namespace
Test
{
54
67
extern
std::ostringstream
olog
;
68
70
class
ind
{
71
public
:
73
int
l
;
75
ind
(
int
i
) :
l
(
i
) {}
76
};
77
78
80
class
Options
{
81
public
:
83
unsigned
int
seed
;
85
unsigned
int
iter
;
87
static
const
int
defiter
= 5;
89
unsigned
int
fixprob
;
91
static
const
unsigned
int
deffixprob
= 10;
93
bool
stop
;
95
bool
log
;
96
98
Options
(
void
);
100
void
parse
(
int
argc,
char
* argv[]);
101
};
102
104
extern
Options
opt
;
105
107
class
Base
{
108
private
:
110
std::string _name;
112
Base
* _next;
114
static
Base
* _tests;
116
static
unsigned
int
_n_tests;
117
public
:
119
Base
(
const
std::string& s);
121
static
void
sort
(
void
);
123
const
std::string&
name
(
void
)
const
;
125
static
Base
*
tests
(
void
);
127
Base
*
next
(
void
)
const
;
129
void
next
(
Base
*
n
);
131
virtual
bool
run
(
void
) = 0;
133
static
bool
fixpoint
(
void
);
135
virtual
~Base
(
void
);
136
138
static
Gecode::Support::RandomGenerator
rand
;
139
};
141
142
}
143
148
int
main
(
int
argc,
char
* argv[]);
149
154
std::ostream&
155
operator<<
(std::ostream& os,
const
Test::ind
&
i
);
156
157
#include "
test/test.hpp
"
158
159
#endif
160
161
// STATISTICS: test-core
kernel.hh
AllInterval::main
int main(int argc, char *argv[])
Main-function.
Definition:
all-interval.cpp:121
Test::Int::Basic::i
Gecode::IntArgs i(4, 1, 2, 3, 4)
Test::Base::sort
static void sort(void)
Sort tests alphabetically.
Definition:
test.cpp:81
search.hh
Test::Base::tests
static Base * tests(void)
Return all tests.
Definition:
test.hpp:58
Test::Base::name
const std::string & name(void) const
Return name of test.
Definition:
test.hpp:54
Test::Base::rand
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition:
test.hh:138
Test::Options::iter
unsigned int iter
Number of iterations for each test.
Definition:
test.hh:85
Test::Options::Options
Options(void)
Initialize options with defaults.
Definition:
test.hpp:45
Test::Base
Base class for all tests to be run
Definition:
test.hh:107
Gecode::Float::FloatView::operator<<
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const FloatView &x)
Print float variable view.
Definition:
print.hpp:62
Test::opt
Options opt
The options.
Definition:
test.cpp:101
Test::Options::defiter
static const int defiter
Default number of iterations.
Definition:
test.hh:87
Test::Options::log
bool log
Whether to log the tests.
Definition:
test.hh:95
Test::Options::deffixprob
static const unsigned int deffixprob
Default fixpoint probaibility.
Definition:
test.hh:91
Gecode::Support::LinearCongruentialGenerator
Template for linear congruential generators.
Definition:
random.hpp:50
Test::Base::run
virtual bool run(void)=0
Run test.
Test::ind::ind
ind(int i)
Indent by level i.
Definition:
test.hh:75
Test::Options::fixprob
unsigned int fixprob
The probability for computing a fixpoint.
Definition:
test.hh:89
Test::Base::fixpoint
static bool fixpoint(void)
Throw a coin whether to compute a fixpoint.
Definition:
test.hpp:70
test.hpp
Test::Base::next
Base * next(void) const
Return next test.
Definition:
test.hpp:62
Test::Options
Commandline options.
Definition:
test.hh:80
Test::ind
Simple class for describing identation.
Definition:
test.hh:70
Test
General test support.
Definition:
afc.cpp:43
Test::Options::parse
void parse(int argc, char *argv[])
Parse commandline arguments.
Definition:
test.cpp:124
Test::Base::~Base
virtual ~Base(void)
Destructor.
Definition:
test.cpp:96
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:238
Test::olog
std::ostringstream olog
Stream used for logging.
Definition:
test.cpp:57
Test::ind::l
int l
Which indentation level.
Definition:
test.hh:73
Test::Base::Base
Base(const std::string &s)
Create and register test with name s.
Definition:
test.cpp:63
Test::Options::seed
unsigned int seed
The random seed to be used.
Definition:
test.hh:83
Test::Options::stop
bool stop
Whether to stop on an error.
Definition:
test.hh:93