Navigation Menu

Skip to content

Commit

Permalink
add test case for mrn_init.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikdttr committed Jun 23, 2009
1 parent f05d132 commit 27ba4b3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Makefile.am
@@ -1,4 +1,4 @@
AM_CPPFLAGS = $(MYSQL_INC) $(GROONGA_INCLUDES) $(MECAB_INCLUDES) $(CUTTER_CFLAGS)
AM_CPPFLAGS = $(MYSQL_INC) $(GROONGA_INCLUDES) $(MECAB_INCLUDES)
AM_INCLUDES = -l. -l..
ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS

Expand Down
2 changes: 1 addition & 1 deletion test/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = unit

TESTS = unit-test.sh
TESTS = run-unit-test.sh
TESTS_ENVIRONMENT = CUTTER="$(CUTTER)"

echo-cutter:
Expand Down
File renamed without changes.
28 changes: 24 additions & 4 deletions test/unit/test-driver.c
@@ -1,10 +1,32 @@
#include <cutter.h>
#include <gcutter.h>
#include <glib/gstdio.h>
#include "driver.h"

void test_mrn_init()
static gchar *base_directory;
static gchar *tmp_directory;
static grn_ctx *ctx;

void cut_startup()
{
base_directory = g_get_current_dir();
tmp_directory = g_build_filename(base_directory, "/tmp", NULL);
cut_remove_path(tmp_directory, NULL);
g_mkdir_with_parents(tmp_directory, 0700);
g_chdir(tmp_directory);
grn_init();
grn_ctx_init(ctx,0);
}

void cut_shutdown()
{
grn_ctx_fin(ctx);
grn_fin();
g_chdir(base_directory);
g_free(tmp_directory);
}

void test_mrn_init()
{
mrn_db = NULL;
mrn_hash = NULL;
mrn_lexicon = NULL;
Expand All @@ -13,6 +35,4 @@ void test_mrn_init()
cut_assert_not_null(mrn_db);
cut_assert_not_null(mrn_hash);
cut_assert_not_null(mrn_lexicon);

grn_fin();
}

0 comments on commit 27ba4b3

Please sign in to comment.