OpenWalnut  1.5.0dev
WGrid_test.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WGRID_TEST_H
26 #define WGRID_TEST_H
27 
28 #include <utility>
29 
30 #include <cxxtest/TestSuite.h>
31 
32 #include "../../common/WProperties.h"
33 #include "../WGrid.h"
34 
35 /**
36  * Dummy class for testing the abstract class WGrid
37  */
38 class Dummy : public WGrid
39 {
40 friend class WGridTest; //!< Access for test class.
41 
42 public:
43  /**
44  * Standard constructor of Dummy class.
45  * \param size number of positions
46  */
47  explicit Dummy( size_t size )
48  : WGrid( size )
49  {
50  }
51 
52  /**
53  * Returns dummy bounding box.
54  *
55  * \return bbox
56  */
57  virtual WBoundingBox getBoundingBox() const
58  {
59  return WBoundingBox( WPosition( 0, 0, 0 ), WPosition( 1, 1, 1 ) );
60  }
61 };
62 
63 /**
64  * Tests the WGrid class.
65  */
66 class WGridTest : public CxxTest::TestSuite
67 {
68 public:
69  /**
70  * Checks if the Dummy is instanceable.
71  */
72  void testInstantiation( void )
73  {
74  TS_ASSERT_THROWS_NOTHING( Dummy d( 1 ) );
75  }
76 
77  /**
78  * After instantiation there should be only 1 positions.
79  */
80  void testSize( void )
81  {
82  Dummy grid( 1 );
83  TS_ASSERT_EQUALS( grid.size(), 1 );
84  }
85 };
86 
87 #endif // WGRID_TEST_H
Dummy class for testing the abstract class WGrid.
Definition: WGrid_test.h:39
virtual WBoundingBox getBoundingBox() const
Returns dummy bounding box.
Definition: WGrid_test.h:57
virtual size_t size() const
Get the size.
Dummy(size_t size)
Standard constructor of Dummy class.
Definition: WGrid_test.h:47
Tests the WGrid class.
Definition: WGrid_test.h:67
void testInstantiation(void)
Checks if the Dummy is instanceable.
Definition: WGrid_test.h:72
void testSize(void)
After instantiation there should be only 1 positions.
Definition: WGrid_test.h:80
Base class to all grid types, e.g.
Definition: WGrid.h:43
This only is a 3d double vector.