Core tests for C bindings

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7ec1cb80
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7ec1cb80
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7ec1cb80

Branch: refs/heads/c-bindings-wip2
Commit: 7ec1cb80ee3e4fd79ad80a334e8a900906e5c24a
Parents: cadb37a
Author: Nick Wellnhofer <[email protected]>
Authored: Sun Feb 24 19:54:52 2013 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Sun Feb 24 20:43:56 2013 +0100

----------------------------------------------------------------------
 c/.gitignore            |    1 +
 c/t/test_lucy.c         |   32 ++++++++++++++++++++++++++++++++
 common/charmonizer.main |   14 ++++++++++++++
 3 files changed, 47 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7ec1cb80/c/.gitignore
----------------------------------------------------------------------
diff --git a/c/.gitignore b/c/.gitignore
index 1076813..f030662 100644
--- a/c/.gitignore
+++ b/c/.gitignore
@@ -3,3 +3,4 @@
 /charmonizer
 /charmony.h
 /liblucy.dylib
+/t/test_lucy

http://git-wip-us.apache.org/repos/asf/lucy/blob/7ec1cb80/c/t/test_lucy.c
----------------------------------------------------------------------
diff --git a/c/t/test_lucy.c b/c/t/test_lucy.c
new file mode 100644
index 0000000..080bd45
--- /dev/null
+++ b/c/t/test_lucy.c
@@ -0,0 +1,32 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "Clownfish/Test/TestFormatter.h"
+#include "Lucy/Test.h"
+
+int
+main() {
+    lucy_bootstrap_parcel();
+
+    lucy_TestFormatterCF *formatter = lucy_TestFormatterCF_new();
+    bool success = lucy_Test_run_all_batches((lucy_TestFormatter*)formatter);
+    CFISH_DECREF(formatter);
+
+    return success ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+

http://git-wip-us.apache.org/repos/asf/lucy/blob/7ec1cb80/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 5cf0c38..4ed6be1 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -237,12 +237,17 @@ S_write_makefile() {
     chaz_MakeVar_append(var, "$(AUTOGEN_DIR)" DIR_SEP "source" DIR_SEP
                         "parcel$(OBJ_EXT)");
 
+    chaz_MakeFile_add_var(makefile, "TEST_LUCY_OBJS",
+                          "t" DIR_SEP "test_lucy$(OBJ_EXT)");
+
     /* Executables */
 
     chaz_MakeFile_add_var(makefile, "LEMON_EXE",
                           "$(LEMON_DIR)" DIR_SEP "lemon$(EXE_EXT)");
     chaz_MakeFile_add_var(makefile, "CFC_EXE",
                           "$(CFC_DIR)" DIR_SEP "cfc$(EXE_EXT)");
+    chaz_MakeFile_add_var(makefile, "TEST_LUCY_EXE",
+                          "t" DIR_SEP "test_lucy$(EXE_EXT)");
 
     /* Shared library */
 
@@ -275,6 +280,15 @@ S_write_makefile() {
 
     chaz_MakeFile_add_shared_obj(makefile, "$(LUCY_SHOBJ)", "$(LUCY_OBJS)");
 
+    chaz_MakeFile_add_rule(makefile, "$(TEST_LUCY_OBJS)", "$(AUTOGEN_DIR)");
+
+    rule = chaz_MakeFile_add_exe(makefile, "$(TEST_LUCY_EXE)",
+                                 "$(TEST_LUCY_OBJS)", "-L. -llucy");
+    chaz_MakeRule_add_prereq(rule, "$(LUCY_SHOBJ)");
+
+    rule = chaz_MakeFile_add_rule(makefile, "test", "$(TEST_LUCY_EXE)");
+    chaz_MakeRule_add_command(rule, "$(TEST_LUCY_EXE)");
+
     chaz_MakeFile_add_to_cleanup(makefile, "$(LUCY_OBJS)");
     chaz_MakeFile_add_to_cleanup(makefile, "$(AUTOGEN_DIR)");
     chaz_MakeFile_add_to_cleanup(makefile, json_parser_h);

Reply via email to