[Groonga-commit] groonga/groonga [master] fix assertions.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 11月 11日 (金) 17:05:08 JST


Susumu Yata	2011-11-11 08:05:08 +0000 (Fri, 11 Nov 2011)

  New Revision: 5c6f96492b55c8666d0f24b15a5a947c747b3f90

  Log:
    fix assertions.

  Modified files:
    test/unit/core/dat/test-cursor-factory.cpp
    test/unit/core/dat/test-id-cursor.cpp
    test/unit/core/dat/test-string.cpp
    test/unit/core/dat/test-trie.cpp

  Modified: test/unit/core/dat/test-cursor-factory.cpp (+2 -2)
===================================================================
--- test/unit/core/dat/test-cursor-factory.cpp    2011-11-11 07:45:59 +0000 (1348927)
+++ test/unit/core/dat/test-cursor-factory.cpp    2011-11-11 08:05:08 +0000 (3e4bc52)
@@ -48,7 +48,7 @@ namespace test_dat_cursor_factory
         trie, "apple", 5, "melon", 5, 1, 2,
         grn::dat::KEY_RANGE_CURSOR | grn::dat::EXCEPT_LOWER_BOUND |
         grn::dat::EXCEPT_UPPER_BOUND));
-    cut_assert(cursor.get() != static_cast<grn::dat::Cursor *>(NULL));
+    cut_assert_not_null(cursor.get());
 
     cppcut_assert_equal(grn::dat::UInt32(1), cursor->offset());
     cppcut_assert_equal(grn::dat::UInt32(2), cursor->limit());
@@ -65,7 +65,7 @@ namespace test_dat_cursor_factory
     std::auto_ptr<grn::dat::Cursor> cursor(grn::dat::CursorFactory::open(
         trie, "apple", 5, "melon", 5, 1, 2,
         grn::dat::ID_RANGE_CURSOR | grn::dat::ASCENDING_CURSOR));
-    cut_assert(cursor.get() != static_cast<grn::dat::Cursor *>(NULL));
+    cut_assert_not_null(cursor.get());
 
     cppcut_assert_equal(grn::dat::UInt32(1), cursor->offset());
     cppcut_assert_equal(grn::dat::UInt32(2), cursor->limit());

  Modified: test/unit/core/dat/test-id-cursor.cpp (+8 -8)
===================================================================
--- test/unit/core/dat/test-id-cursor.cpp    2011-11-11 07:45:59 +0000 (ff0ac2e)
+++ test/unit/core/dat/test-id-cursor.cpp    2011-11-11 08:05:08 +0000 (7c4fb2a)
@@ -64,7 +64,7 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("スダチ", std::strlen("スダチ"), &key_pos));
+    cppcut_assert_equal(true, trie.search("スダチ", std::strlen("スダチ"), &key_pos));
     const grn::dat::UInt32 min_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;
@@ -83,7 +83,7 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("オレンジ", std::strlen("オレンジ"), &key_pos));
+    cppcut_assert_equal(true, trie.search("オレンジ", std::strlen("オレンジ"), &key_pos));
     const grn::dat::UInt32 max_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;
@@ -102,9 +102,9 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("みかん", std::strlen("みかん"), &key_pos));
+    cppcut_assert_equal(true, trie.search("みかん", std::strlen("みかん"), &key_pos));
     const grn::dat::UInt32 min_key_id = trie.get_key(key_pos).id();
-    cut_assert(trie.search("八朔", std::strlen("八朔"), &key_pos));
+    cppcut_assert_equal(true, trie.search("八朔", std::strlen("八朔"), &key_pos));
     const grn::dat::UInt32 max_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;
@@ -138,7 +138,7 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("伊予柑", std::strlen("伊予柑"), &key_pos));
+    cppcut_assert_equal(true, trie.search("伊予柑", std::strlen("伊予柑"), &key_pos));
     const grn::dat::UInt32 min_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;
@@ -157,7 +157,7 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("柚子", std::strlen("柚子"), &key_pos));
+    cppcut_assert_equal(true, trie.search("柚子", std::strlen("柚子"), &key_pos));
     const grn::dat::UInt32 max_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;
@@ -176,9 +176,9 @@ namespace test_dat_id_cursor
     create_trie(&trie);
 
     grn::dat::UInt32 key_pos;
-    cut_assert(trie.search("グレープフルーツ", std::strlen("グレープフルーツ"), &key_pos));
+    cppcut_assert_equal(true, trie.search("グレープフルーツ", std::strlen("グレープフルーツ"), &key_pos));
     const grn::dat::UInt32 min_key_id = trie.get_key(key_pos).id();
-    cut_assert(trie.search("文旦", std::strlen("文旦"), &key_pos));
+    cppcut_assert_equal(true, trie.search("文旦", std::strlen("文旦"), &key_pos));
     const grn::dat::UInt32 max_key_id = trie.get_key(key_pos).id();
 
     grn::dat::IdCursor cursor;

  Modified: test/unit/core/dat/test-string.cpp (+4 -4)
===================================================================
--- test/unit/core/dat/test-string.cpp    2011-11-11 07:45:59 +0000 (a0271e3)
+++ test/unit/core/dat/test-string.cpp    2011-11-11 08:05:08 +0000 (b746638)
@@ -100,10 +100,10 @@ namespace test_dat_string
     const grn::dat::String str("apple");
 
     cppcut_assert_equal(0, str.compare(grn::dat::String("apple")));
-    cut_assert(str.compare(grn::dat::String("appl")) > 0);
-    cut_assert(str.compare(grn::dat::String("appleX")) < 0);
-    cut_assert(str.compare(grn::dat::String("banana")) < 0);
-    cut_assert(str.compare(grn::dat::String("and")) > 0);
+    cut_assert_operator(str.compare(grn::dat::String("appl")), >, 0);
+    cut_assert_operator(str.compare(grn::dat::String("appleX")), <, 0);
+    cut_assert_operator(str.compare(grn::dat::String("banana")), <, 0);
+    cut_assert_operator(str.compare(grn::dat::String("and")), >, 0);
   }
 
   void test_starts_with(void)

  Modified: test/unit/core/dat/test-trie.cpp (+2 -2)
===================================================================
--- test/unit/core/dat/test-trie.cpp    2011-11-11 07:45:59 +0000 (0da174e)
+++ test/unit/core/dat/test-trie.cpp    2011-11-11 08:05:08 +0000 (6d6eeff)
@@ -351,9 +351,9 @@ namespace test_dat_trie
     cppcut_assert_equal(src_trie.num_keys(), dest_trie.num_keys());
     cppcut_assert_equal(src_trie.next_key_pos(), dest_trie.next_key_pos());
 
-    cut_assert(dest_trie.num_nodes() < src_trie.num_nodes());
+    cut_assert_operator(dest_trie.num_nodes(), <, src_trie.num_nodes());
     cppcut_assert_equal(grn::dat::UInt32(0), dest_trie.num_zombies());
-    cut_assert(dest_trie.num_blocks() < src_trie.num_nodes());
+    cut_assert_operator(dest_trie.num_blocks(), <, src_trie.num_nodes());
   }
 
   void test_random_queries(void)




Groonga-commit メーリングリストの案内
Back to archive index