region.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2009
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <gecode/kernel.hh>
#include <gecode/int.hh>
#include "test/test.hh"
namespace Test {
class Region : public Test::Base {
protected:
static const int n_repeat = 16;
static const int n_blocks = 64;
static const size_t size =
Gecode::Kernel::MemoryConfig::region_area_size * 4;
public:
Region(void) : Test::Base("Region") {}
bool run(void) {
for (int i=n_repeat; i--; ) {
Gecode::Region r;
for (int j=n_blocks; j--; )
(void) r.alloc<char>(static_cast<unsigned long int>(size));
}
return true;
}
};
Region r;
}
// STATISTICS: test-core
Gecode::Region
Handle to region.
Definition region.hpp:55
Test::Base
Base class for all tests to be run
Definition test.hh:103
Test::Base::Base
Base(const std::string &s)
Create and register test with name s.
Definition test.cpp:59
Test::Region
Test for Region memory area
Definition region.cpp:42
Test::Region::Region
Region(void)
Initialize test.
Definition region.cpp:53
Test::Region::n_repeat
static const int n_repeat
How often to repeat.
Definition region.cpp:45
Test::Region::size
static const size_t size
The size of a block.
Definition region.cpp:49
Test::Region::n_blocks
static const int n_blocks
How many blocks to allocate.
Definition region.cpp:47
Test::Region::run
bool run(void)
Perform actual tests.
Definition region.cpp:55
int.hh
kernel.hh
Gecode::Kernel::MemoryConfig::region_area_size
const size_t region_area_size
Size of region area.
Definition config.hpp:134
Test
General test support.
Definition afc.cpp:39
Test::r
Region r
Definition region.cpp:65
test.hh