Kouhei Sutou
null+****@clear*****
Tue Sep 24 16:51:16 JST 2013
Kouhei Sutou 2013-09-24 16:51:16 +0900 (Tue, 24 Sep 2013) New Revision: 1b4b8372e57f1ce0f7528f6cd40e5b76b394277b https://github.com/groonga/groonga/commit/1b4b8372e57f1ce0f7528f6cd40e5b76b394277b Message: test: move cache_limit test to grntest tests from Cutter tests Added files: test/command/suite/cache_limit/invalid/minus.expected test/command/suite/cache_limit/invalid/minus.test test/command/suite/cache_limit/invalid/string.expected test/command/suite/cache_limit/invalid/string.test test/command/suite/cache_limit/valid/get.expected test/command/suite/cache_limit/valid/get.test test/command/suite/cache_limit/valid/set.expected test/command/suite/cache_limit/valid/set.test Removed files: test/unit/core/test-command-cache-limit.c Modified files: test/unit/core/Makefile.am Added: test/command/suite/cache_limit/invalid/minus.expected (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/invalid/minus.expected 2013-09-24 16:51:16 +0900 (2883039) @@ -0,0 +1,3 @@ +cache_limit --max -1 +[[[-22,0.0,0.0],"max value is invalid unsigned integer format: <-1>"],100] +#|e| max value is invalid unsigned integer format: <-1> Added: test/command/suite/cache_limit/invalid/minus.test (+1 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/invalid/minus.test 2013-09-24 16:51:16 +0900 (c4fb286) @@ -0,0 +1 @@ +cache_limit --max -1 Added: test/command/suite/cache_limit/invalid/string.expected (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/invalid/string.expected 2013-09-24 16:51:16 +0900 (1f67ed0) @@ -0,0 +1,3 @@ +cache_limit --max LIMIT +[[[-22,0.0,0.0],"max value is invalid unsigned integer format: <LIMIT>"],100] +#|e| max value is invalid unsigned integer format: <LIMIT> Added: test/command/suite/cache_limit/invalid/string.test (+1 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/invalid/string.test 2013-09-24 16:51:16 +0900 (5527f7d) @@ -0,0 +1 @@ +cache_limit --max LIMIT Added: test/command/suite/cache_limit/valid/get.expected (+2 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/valid/get.expected 2013-09-24 16:51:16 +0900 (fd6e42f) @@ -0,0 +1,2 @@ +cache_limit +[[0,0.0,0.0],100] Added: test/command/suite/cache_limit/valid/get.test (+1 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/valid/get.test 2013-09-24 16:51:16 +0900 (06979b1) @@ -0,0 +1 @@ +cache_limit Added: test/command/suite/cache_limit/valid/set.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/valid/set.expected 2013-09-24 16:51:16 +0900 (992bb60) @@ -0,0 +1,4 @@ +cache_limit --max 1000 +[[0,0.0,0.0],100] +cache_limit +[[0,0.0,0.0],1000] Added: test/command/suite/cache_limit/valid/set.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/cache_limit/valid/set.test 2013-09-24 16:51:16 +0900 (68040ec) @@ -0,0 +1,4 @@ +cache_limit --max 1000 +cache_limit + + Modified: test/unit/core/Makefile.am (+0 -2) =================================================================== --- test/unit/core/Makefile.am 2013-09-24 12:45:07 +0900 (8c5470b) +++ test/unit/core/Makefile.am 2013-09-24 16:51:16 +0900 (53c9605) @@ -54,7 +54,6 @@ noinst_LTLIBRARIES = \ test-command-select-filter.la \ test-command-select-geo.la \ test-command-define-selector.la \ - test-command-cache-limit.la \ test-command-delete.la \ test-command-dump.la \ test-command-truncate.la \ @@ -144,7 +143,6 @@ test_command_select_query_la_SOURCES = test-command-select-query.c test_command_select_filter_la_SOURCES = test-command-select-filter.c test_command_select_geo_la_SOURCES = test-command-select-geo.c test_command_define_selector_la_SOURCES = test-command-define-selector.c -test_command_cache_limit_la_SOURCES = test-command-cache-limit.c test_command_delete_la_SOURCES = test-command-delete.c test_command_dump_la_SOURCES = test-command-dump.c test_command_truncate_la_SOURCES = test-command-truncate.c Deleted: test/unit/core/test-command-cache-limit.c (+0 -120) 100644 =================================================================== --- test/unit/core/test-command-cache-limit.c 2013-09-24 12:45:07 +0900 (b8d1a6f) +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c-basic-offset: 2; coding: utf-8 -*- */ -/* - Copyright (C) 2010 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 version 2.1 as published by the Free Software Foundation. - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include <gcutter.h> -#include <glib/gstdio.h> - -#include "../lib/grn-assertions.h" - -#include <ctx.h> - -void test_get(void); -void test_set(void); -void test_set_minus(void); - -static gchar *tmp_directory; - -static grn_ctx *context; -static grn_obj *database; - -static uint32_t default_cache_n_entries; - -void -cut_startup(void) -{ - tmp_directory = g_build_filename(grn_test_get_tmp_dir(), - "cache-limit", - NULL); - default_cache_n_entries = *grn_cache_max_nentries(); -} - -void -cut_shutdown(void) -{ - g_free(tmp_directory); -} - -static void -remove_tmp_directory(void) -{ - cut_remove_path(tmp_directory, NULL); -} - -void -cut_setup(void) -{ - const gchar *database_path; - uint32_t *cache_max_n_entries; - - remove_tmp_directory(); - g_mkdir_with_parents(tmp_directory, 0700); - - context = g_new0(grn_ctx, 1); - grn_ctx_init(context, 0); - - database_path = cut_build_path(tmp_directory, "database.groonga", NULL); - database = grn_db_create(context, database_path, NULL); - - cache_max_n_entries = grn_cache_max_nentries(); - *cache_max_n_entries = default_cache_n_entries; -} - -void -cut_teardown(void) -{ - grn_obj_close(context, database); - grn_ctx_fin(context); - g_free(context); - - remove_tmp_directory(); -} - -void -test_get(void) -{ - cut_assert_equal_string("100", send_command("cache_limit")); -} - -void -test_set(void) -{ - cut_assert_equal_string("100", send_command("cache_limit --max 1000")); - cut_assert_equal_string("1000", send_command("cache_limit")); -} - -void -test_set_invalid_minus(void) -{ - grn_test_assert_send_command_error( - context, - GRN_INVALID_ARGUMENT, - "max value is invalid unsigned integer format: <-1>", - "cache_limit --max -1"); - cut_assert_equal_string("100", send_command("cache_limit")); -} - -void -test_set_invalid_string(void) -{ - grn_test_assert_send_command_error( - context, - GRN_INVALID_ARGUMENT, - "max value is invalid unsigned integer format: <LIMIT>", - "cache_limit --max LIMIT"); - cut_assert_equal_string("100", send_command("cache_limit")); -} -------------- next part -------------- HTML����������������������������...Download