[Groonga-commit] groonga/groonga [master] updated to test an error case of grn_dat_remove().

Back to archive index

null+****@clear***** null+****@clear*****
2012年 1月 23日 (月) 10:33:28 JST


Susumu Yata	2012-01-23 10:33:28 +0900 (Mon, 23 Jan 2012)

  New Revision: 84e5354f5f2f2aba352ccc0fcfe0a13cb5cc08c7

  Log:
    updated to test an error case of grn_dat_remove().

  Modified files:
    test/unit/core/dat/test-dat.cpp

  Modified: test/unit/core/dat/test-dat.cpp (+10 -0)
===================================================================
--- test/unit/core/dat/test-dat.cpp    2012-01-23 10:27:22 +0900 (bdcb4db)
+++ test/unit/core/dat/test-dat.cpp    2012-01-23 10:33:28 +0900 (49027c3)
@@ -164,11 +164,20 @@ namespace test_dat
     char dat_path[PATH_MAX];
     std::sprintf(dat_path, "%s/%s", base_dir, "test_remove.tmp");
 
+    cppcut_assert_equal(GRN_NO_SUCH_FILE_OR_DIRECTORY,
+                        grn_dat_remove(&ctx, dat_path));
+    cppcut_assert_equal(GRN_NO_SUCH_FILE_OR_DIRECTORY, ctx.rc);
+    ERRCLR(&ctx);
+
     std::vector<std::string> keys;
     create_keys(&keys, 1000, 6, 15);
 
     grn_dat * const dat = create_trie(keys, dat_path);
+    cppcut_assert_equal(GRN_SUCCESS, grn_dat_repair(&ctx, dat));
+    cppcut_assert_equal(GRN_SUCCESS, grn_dat_repair(&ctx, dat));
+    cppcut_assert_equal(GRN_SUCCESS, grn_dat_repair(&ctx, dat));
     const uint32_t last_file_id = dat->file_id;
+    cppcut_assert_equal(static_cast<uint32_t>(4), last_file_id);
     cppcut_assert_equal(GRN_SUCCESS, grn_dat_close(&ctx, dat));
 
     cppcut_assert_equal(GRN_SUCCESS, grn_dat_remove(&ctx, dat_path));
@@ -178,6 +187,7 @@ namespace test_dat
       std::sprintf(trie_path, "%s.%03d", dat_path, i);
       cut_assert_not_exist_path(trie_path);
     }
+    cppcut_assert_equal(GRN_SUCCESS, ctx.rc);
 
     cppcut_assert_equal(GRN_INVALID_ARGUMENT, grn_dat_remove(&ctx, NULL));
   }




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