diff options
author | Kentoku SHIBA <kentokushiba@gmail.com> | 2014-10-21 04:51:38 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2014-10-21 04:51:38 +0900 |
commit | 7f3d55508790c928fc57b6a6ada79c8202598a58 (patch) | |
tree | 7c48447bf47bff96844c5f2557ac9e185c6b9a92 /storage/mroonga/test | |
parent | 1cdd679ce574208fd52e08bb0e4429a55fea8fd2 (diff) | |
download | mariadb-git-7f3d55508790c928fc57b6a6ada79c8202598a58.tar.gz |
Update Mroonga to the latest version on 2014-10-21T04:51:38+0900
Diffstat (limited to 'storage/mroonga/test')
-rw-r--r-- | storage/mroonga/test/unit/Makefile.am | 7 | ||||
-rw-r--r-- | storage/mroonga/test/unit/test_mrn_sys.cpp | 95 |
2 files changed, 0 insertions, 102 deletions
diff --git a/storage/mroonga/test/unit/Makefile.am b/storage/mroonga/test/unit/Makefile.am index 30c9ca20486..3950ce0dc7f 100644 --- a/storage/mroonga/test/unit/Makefile.am +++ b/storage/mroonga/test/unit/Makefile.am @@ -1,6 +1,5 @@ if WITH_CUTTER noinst_LTLIBRARIES = \ - test_mrn_sys.la \ test_mrn_path_mapper.la endif @@ -21,12 +20,6 @@ LIBS = \ $(GROONGA_LIBS) \ $(MECAB_LIBS) -EXTERNAL_SRC = ../../mrn_sys.cpp - -test_mrn_sys_la_SOURCES = \ - $(EXTERNAL_SRC) \ - test_mrn_sys.cpp - test_mrn_path_mapper_la_SOURCES = \ test_mrn_path_mapper.cpp diff --git a/storage/mroonga/test/unit/test_mrn_sys.cpp b/storage/mroonga/test/unit/test_mrn_sys.cpp deleted file mode 100644 index fcc4b768efe..00000000000 --- a/storage/mroonga/test/unit/test_mrn_sys.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- c-basic-offset: 2 -*- */ -/* - Copyright(C) 2010 Tetsuro IKEDA - Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <string.h> -#include <cppcutter.h> - -#include <mrn_sys.hpp> - -static grn_ctx *ctx; -static grn_obj *db; -static grn_hash *hash; -static grn_obj buffer; - -namespace test_mrn_sys -{ - void cut_startup() - { - ctx = (grn_ctx *)malloc(sizeof(grn_ctx)); - grn_init(); - grn_ctx_init(ctx, 0); - db = grn_db_create(ctx, NULL, NULL); - grn_ctx_use(ctx, db); - } - - void cut_shutdown() - { - grn_obj_unlink(ctx, db); - grn_ctx_fin(ctx); - grn_fin(); - free(ctx); - } - - void cut_setup() - { - hash = grn_hash_create(ctx, NULL, 1024, sizeof(grn_obj *), - GRN_OBJ_KEY_VAR_SIZE); - GRN_TEXT_INIT(&buffer, 0); - } - - void cut_teardown() - { - grn_hash_close(ctx, hash); - grn_obj_unlink(ctx, &buffer); - } - - void test_mrn_hash_put() - { - const char *key = "mroonga"; - - cut_assert_true(mrn_hash_put(ctx, hash, key, &buffer)); - cut_assert_false(mrn_hash_put(ctx, hash, key, &buffer)); - } - - void test_mrn_hash_get() - { - const char *key = "mroonga"; - const char *value = "A storage engine based on groonga."; - grn_obj *result; - - GRN_TEXT_SETS(ctx, &buffer, value); - GRN_TEXT_PUT(ctx, &buffer, "\0", 1); - - mrn_hash_put(ctx, hash, key, &buffer); - cut_assert_true(mrn_hash_get(ctx, hash, key, &result)); - cppcut_assert_equal(value, GRN_TEXT_VALUE(&buffer)); - } - - void test_mrn_hash_remove() - { - const char *key = "mroonga"; - - mrn_hash_put(ctx, hash, key, &buffer); - - cut_assert_false(mrn_hash_remove(ctx, hash, "nonexistent")); - cut_assert_true(mrn_hash_remove(ctx, hash, key)); - cut_assert_false(mrn_hash_remove(ctx, hash, key)); - } -} |