Generated on Thu Mar 22 10:39:47 2012 for Gecode by doxygen 1.6.3

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: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $ by $Author: schulte $
00015  *     $Revision: 10684 $
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 Options {
00081   public:
00083     unsigned int seed;
00085     unsigned int iter;
00087     static const int defiter = 5;
00089     unsigned int fixprob;
00091     static const unsigned int deffixprob = 10;
00093     bool stop;
00095     bool log;
00096 
00098     Options(void);
00100     void parse(int argc, char* argv[]);
00101   };
00102 
00104   extern Options opt;
00105 
00107   class Base {
00108   private:
00110     std::string _name;
00112     Base* _next;
00114     static Base* _tests;
00116     static unsigned int _n_tests;
00117   public:
00119     Base(const std::string& s);
00121     static void sort(void);
00123     const std::string& name(void) const;
00125     static Base* tests(void);
00127     Base* next(void) const;
00129     void next(Base* n);
00131     virtual bool run(void) = 0;
00133     static bool fixpoint(void);
00135     virtual ~Base(void);
00136 
00138     static Gecode::Support::RandomGenerator rand;
00139   };
00141 
00142 }
00143 
00148 int main(int argc, char* argv[]);
00149 
00154 std::ostream&
00155 operator<<(std::ostream& os, const Test::ind& i);
00156 
00157 #include "test/test.hpp"
00158 
00159 #endif
00160 
00161 // STATISTICS: test-core