Navigation Menu

Skip to content

Commit

Permalink
add groonga api sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
mir committed Aug 8, 2009
1 parent 86e3dbb commit e69f984
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/unit/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = test_start_stop.la test_driver.la
noinst_LTLIBRARIES = test_start_stop.la test_driver.la api_sample.la

AM_CPPFLAGS = $(GROONGA_INCLUDES) $(MECAB_INCLUDES) $(CUTTER_CFLAGS) $(GCUTTER_CFLAGS)
AM_INCLUDES = -l. -l..
Expand All @@ -14,3 +14,4 @@ DRIVER_SRC = ../../driver.c

test_start_stop_la_SOURCES = $(DRIVER_SRC) test-start-stop.c
test_driver_la_SOURCES = $(DRIVER_SRC) test-driver.c
api_sample_la_SOURCES = api-sample.c
22 changes: 22 additions & 0 deletions test/unit/api-sample.c
@@ -0,0 +1,22 @@
#include <gcutter.h>
#include <glib/gstdio.h>
#include <groonga.h>

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);
}

void cut_shutdown()
{
g_chdir(base_directory);
g_free(tmp_directory);
}

0 comments on commit e69f984

Please sign in to comment.