Generated on Mon Aug 25 11:35:45 2008 for Gecode by doxygen 1.5.6

test.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Contributing authors:
00007  *     Mikael Lagerkvist <lagerkvist@gecode.org>
00008  *
00009  *  Copyright:
00010  *     Christian Schulte, 2005
00011  *     Mikael Lagerkvist, 2005
00012  *
00013  *  Last modified:
00014  *     $Date: 2007-11-13 16:40:29 +0100 (Tue, 13 Nov 2007) $ by $Author: zayenz $
00015  *     $Revision: 5284 $
00016  *
00017  *  This file is part of Gecode, the generic constraint
00018  *  development environment:
00019  *     http://www.gecode.org
00020  *
00021  *  Permission is hereby granted, free of charge, to any person obtaining
00022  *  a copy of this software and associated documentation files (the
00023  *  "Software"), to deal in the Software without restriction, including
00024  *  without limitation the rights to use, copy, modify, merge, publish,
00025  *  distribute, sublicense, and/or sell copies of the Software, and to
00026  *  permit persons to whom the Software is furnished to do so, subject to
00027  *  the following conditions:
00028  *
00029  *  The above copyright notice and this permission notice shall be
00030  *  included in all copies or substantial portions of the Software.
00031  *
00032  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00033  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00034  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00035  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00036  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00037  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00038  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00039  *
00040  */
00041 
00042 #ifndef __GECODE_TEST_TEST_HH__
00043 #define __GECODE_TEST_TEST_HH__
00044 
00045 #include "gecode/kernel.hh"
00046 #include "gecode/search.hh"
00047 
00048 #include <iostream>
00049 #include <sstream>
00050 #include <string>
00051 
00053 namespace Test {
00054 
00067   extern std::ostringstream olog;
00068 
00070   class ind {
00071   public:
00073     int l;
00075     ind(int i) : l(i) {}
00076   };
00077 
00078 
00080   class PropKinds {
00081   private:
00083     static const Gecode::PropKind pks[2];
00085     int i; 
00086   public:
00088     PropKinds(void);
00090     bool operator()(void) const;
00092     void operator++(void);
00094     Gecode::PropKind pk(void) const;
00095   };
00096 
00098   class Options {
00099   public:
00101     unsigned int seed;
00103     unsigned int iter;
00105     static const int defiter = 5;
00107     unsigned int fixprob;
00109     static const unsigned int deffixprob = 10;
00111     bool reflection;
00113     bool stop;
00115     bool log;
00116 
00118     Options(void);
00120     void parse(int argc, char* argv[]);
00121   };
00122   
00124   extern Options opt;
00125 
00127   class Base {
00128   private:
00130     std::string _name;
00132     Base* _next;
00134     static Base* _tests;
00135   public:
00137     Base(const std::string& s);
00139     const std::string& name(void) const;
00141     static Base* tests(void);
00143     Base* next(void) const;
00145     virtual bool run(void) = 0;
00147     static bool fixpoint(void);
00149     virtual ~Base(void);
00150 
00152     static Gecode::Support::RandomGenerator rand;
00153   };
00155 
00156 }
00157 
00162 int main(int argc, char* argv[]);
00163 
00168 std::ostream&
00169 operator<<(std::ostream& os, const Test::ind& i);
00170 
00171 #include "test/test.icc"
00172 
00173 #endif
00174 
00175 // STATISTICS: test-core