[towel-db commit] r43 - in trunk/c: . tests

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 22, 2008, 11:38:37 AM7/22/08
to toweldb...@googlegroups.com
Author: i80and
Date: Tue Jul 22 08:38:00 2008
New Revision: 43

Added:
trunk/c/tests/
trunk/c/tests/CMakeLists.txt
trunk/c/tests/test_db.c
Modified:
trunk/c/CMakeLists.txt

Log:
- Set up the inital test infrastructure.
- Create a test to test database creation.


Modified: trunk/c/CMakeLists.txt
==============================================================================
--- trunk/c/CMakeLists.txt (original)
+++ trunk/c/CMakeLists.txt Tue Jul 22 08:38:00 2008
@@ -1,3 +1,5 @@
project(TOWELDB C)
+enable_testing()
add_subdirectory(lib)
add_subdirectory(include)
+add_subdirectory(tests)

Added: trunk/c/tests/CMakeLists.txt
==============================================================================
--- (empty file)
+++ trunk/c/tests/CMakeLists.txt Tue Jul 22 08:38:00 2008
@@ -0,0 +1,8 @@
+include_directories(${TOWELDB_SOURCE_DIR}/include)
+link_directories(${TOWELDB_SOURCE_DIR}/lib)
+
+add_executable(test_db test_db.c)
+target_link_libraries(test_db toweldb)
+
+set_target_properties(test_db PROPERTIES COMPILE_FLAGS -Wall)
+add_test(database test_db)

Added: trunk/c/tests/test_db.c
==============================================================================
--- (empty file)
+++ trunk/c/tests/test_db.c Tue Jul 22 08:38:00 2008
@@ -0,0 +1,33 @@
+/* towel-db - A human readable database system.
+ * Copyright (C) 2008 Andrew <i80...@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "toweldb.h"
+
+int main( int argc, char* argv[] )
+{
+ toweldb_db* db = NULL;
+
+ db = toweldb_open( "./testdb", 'c' );
+ if( db == NULL )
+ {
+ return 1;
+ }
+
+ toweldb_close( db );
+
+ return 0;
+}

Reply all
Reply to author
Forward
0 new messages