Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
test-block.cpp
Go to the documentation of this file.
1 /* -*- c-basic-offset: 2; coding: utf-8 -*- */
2 /*
3  Copyright (C) 2011 Brazil
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License version 2.1 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include <gcutter.h>
20 #include <cppcutter.h>
21 
22 #include <grn-assertions.h>
23 #include <dat/block.hpp>
24 
25 namespace test_dat_block
26 {
28  {
29  const grn::dat::Block block;
30 
31  cppcut_assert_equal(grn::dat::UInt32(0), block.next());
32  cppcut_assert_equal(grn::dat::UInt32(0), block.prev());
33  cppcut_assert_equal(grn::dat::UInt32(0), block.level());
34  cppcut_assert_equal(grn::dat::UInt32(0), block.failure_count());
35  cppcut_assert_equal(grn::dat::UInt32(0), block.first_phantom());
36  cppcut_assert_equal(grn::dat::UInt32(0), block.num_phantoms());
37  }
38 
40  {
41  grn::dat::Block block;
42 
43  block.set_next(101);
44  block.set_prev(99);
45  cppcut_assert_equal(grn::dat::UInt32(101), block.next());
46  cppcut_assert_equal(grn::dat::UInt32(99), block.prev());
47  }
48 
50  {
51  grn::dat::Block block;
52 
55  cppcut_assert_equal(grn::dat::MAX_BLOCK_LEVEL, block.level());
56  cppcut_assert_equal(grn::dat::MAX_FAILURE_COUNT, block.failure_count());
57  }
58 
60  {
61  grn::dat::Block block;
62 
63  block.set_first_phantom(37);
64  block.set_num_phantoms(89);
65  cppcut_assert_equal(grn::dat::UInt32(37), block.first_phantom());
66  cppcut_assert_equal(grn::dat::UInt32(89), block.num_phantoms());
67  }
68 }