Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
test-entry.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/entry.hpp>
24 
25 namespace test_dat_entry
26 {
28  {
29  const grn::dat::Entry entry;
30 
31  cppcut_assert_equal(false, entry.is_valid());
32  cppcut_assert_equal(grn::dat::UInt32(0), entry.next());
33  }
34 
35  void test_valid_entry(void)
36  {
38 
39  entry.set_key_pos(100);
40  cppcut_assert_equal(true, entry.is_valid());
41  cppcut_assert_equal(grn::dat::UInt32(100), entry.key_pos());
42  }
43 
44  void test_invalid_entry(void)
45  {
47 
48  entry.set_next(200);
49  cppcut_assert_equal(false, entry.is_valid());
50  cppcut_assert_equal(grn::dat::UInt32(200), entry.next());
51  }
52 }