[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28799] branches/soc-2010-leifandersen: I added a brief sample of the type of links that I've tried to do.

Leif Andersen leif.a.andersen at gmail.com
Mon May 17 02:10:16 CEST 2010


Revision: 28799
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28799
Author:   leifandersen
Date:     2010-05-17 02:10:16 +0200 (Mon, 17 May 2010)

Log Message:
-----------
I added a brief sample of the type of links that I've tried to do.  There isn't really any tests in here, just a sample of what could be a test.  Also, the architecture of the folder needs to be changed, preferably to something that mimicks the current source direcotory.  Also, the gtest source folder has been moved to the extern/ folder.  Finally, note that this code does not compile!  Neither of the two attempts presented in this folder are properly linked.  The header files are linked in both, however, the libraries are not working, yet.  Note that these are only my most recent efforts, leaving out many of my earlier attempts.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/CMakeLists.txt
    branches/soc-2010-leifandersen/extern/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2010-leifandersen/extern/gtest-1.5.0/
    branches/soc-2010-leifandersen/tests/gtest/
    branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/gtest/firsttest.cpp
    branches/soc-2010-leifandersen/tests/gtest/secondtest.c

Removed Paths:
-------------
    branches/soc-2010-leifandersen/tests/gtest-1.5.0/

Modified: branches/soc-2010-leifandersen/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/CMakeLists.txt	2010-05-16 23:25:05 UTC (rev 28798)
+++ branches/soc-2010-leifandersen/CMakeLists.txt	2010-05-17 00:10:16 UTC (rev 28799)
@@ -689,3 +689,11 @@
 IF(WITH_PLAYER)
 	ADD_SUBDIRECTORY(source/blenderplayer)
 ENDIF(WITH_PLAYER)
+
+#-----------------------------------------------------------------------------
+# Leif's tests, should be removed.
+
+OPTION(WITH_TESTS "Includes a test suite for blender" ON)
+IF(WITH_TESTS)
+	ADD_SUBDIRECTORY(tests)
+ENDIF(WITH_TESTS)

Modified: branches/soc-2010-leifandersen/extern/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/extern/CMakeLists.txt	2010-05-16 23:25:05 UTC (rev 28798)
+++ branches/soc-2010-leifandersen/extern/CMakeLists.txt	2010-05-17 00:10:16 UTC (rev 28799)
@@ -45,3 +45,8 @@
 IF(WITH_LZMA)
 	ADD_SUBDIRECTORY(lzma)
 ENDIF(WITH_LZMA)
+
+#-----------------------------------------------------------------------------
+if(WITH_TESTS)
+	ADD_SUBDIRECTORY(gtest-1.5.0)
+ENDIF(WITH_TESTS)

Copied: branches/soc-2010-leifandersen/extern/gtest-1.5.0 (from rev 28771, branches/soc-2010-leifandersen/tests/gtest-1.5.0)

Modified: branches/soc-2010-leifandersen/tests/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/CMakeLists.txt	2010-05-16 23:25:05 UTC (rev 28798)
+++ branches/soc-2010-leifandersen/tests/CMakeLists.txt	2010-05-17 00:10:16 UTC (rev 28799)
@@ -1,2 +1,2 @@
-add_subdirectory(gtest-1.5.0)
+add_subdirectory(gtest)
 add_subdirectory(pyunit)

Added: branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt	2010-05-17 00:10:16 UTC (rev 28799)
@@ -0,0 +1,55 @@
+# For Google Test
+# Where gtest's .h files can be found.
+include_directories(
+  ${gtest_SOURCE_DIR}/include
+  ${gtest_SOURCE_DIR})
+
+# Where the gtest libraries can be found.
+link_directories(
+  ${gtest_BINARY_DIR}/src)
+
+# cxx_executable(name dir lib srcs...)
+# cxx_executable_with_flags(name cxx_flags lib srcs...)
+cxx_executable_with_flags(
+  firsttest "${cxx_default}" gtest_main "firsttest.cpp" ${ARGN})
+
+#------------------------------------------
+
+#For Linking Blender's Libraries
+FILE(GLOB SRC *.c*)
+
+SET(INC 
+	.
+	${Blender_SOURCE_DIR}/source/blender/blenlib
+	${Blender_SOURCE_DIR}/source/blender/makesdna
+	${Blender_SOURCE_DIR}/source/blender/makesrna
+	${Blender_SOURCE_DIR}/source/blender/blenkernel
+	${Blender_SOURCE_DIR}/source/blender/windowmanager
+	${Blender_SOURCE_DIR}/source/blender/editors/include
+	${Blender_SOURCE_DIR}/intern/guardedalloc
+	${PYTHON_INC}
+	
+	${Blender_SOURCE_DIR}/intern/guardedalloc ../../../intern/memutil ../editors/include ../blenlib ../makesdna ../modifiers
+	${Blender_SOURCE_DIR}/source/blender/render/extern/include ../../../intern/decimation/extern
+	${Blender_SOURCE_DIR}/source/blender/imbuf
+	${Blender_SOURCE_DIR}/source/blender/avi
+	${Blender_SOURCE_DIR}/intern/elbeem/extern
+	${Blender_SOURCE_DIR}/intern/opennl/extern
+	${Blender_SOURCE_DIR}/intern/iksolver/extern
+	${Blender_SOURCE_DIR}/source/blender/blenloader
+	${Blender_SOURCE_DIR}/source/blender/ikplugin
+	${Blender_SOURCE_DIR}/source/blender/nodes
+	${Blender_SOURCE_DIR}/extern/glew/include ../gpu ../makesrna ../../../intern/smoke/extern
+	${Blender_SOURCE_DIR}/intern/bsp/extern ../blenfont
+	${Blender_SOURCE_DIR}/intern/audaspace/intern
+    ${Blender_SOURCE_DIR}/source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
+	${ZLIB_INC}
+)
+
+BLENDERLIB(bf_python_tests "${SRC}" "${INC}")
+
+SETUP_LIBLINKS(firsttest)
+#------------------------
+# Other tests I'm doing
+add_executable(secondtest secondtest.c)
+SETUP_LIBLINKS(secondtest)

Added: branches/soc-2010-leifandersen/tests/gtest/firsttest.cpp
===================================================================
--- branches/soc-2010-leifandersen/tests/gtest/firsttest.cpp	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/gtest/firsttest.cpp	2010-05-17 00:10:16 UTC (rev 28799)
@@ -0,0 +1,62 @@
+#include <gtest/gtest.h>
+extern "C" {
+	#include "BKE_bmesh.h"
+	
+	#include "DNA_listBase.h"
+	#include "BLI_ghash.h"
+	#include "BLI_mempool.h"
+	#include "BLI_memarena.h"
+	#include "DNA_image_types.h"
+	#include "BLI_editVert.h"
+	#include "BKE_DerivedMesh.h"
+}
+namespace {
+
+// The fixture for testing class Foo.
+class FooTest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if its body
+  // is empty.
+
+  FooTest() {
+    // You can do set-up work for each test here.
+	  EditMesh bob;
+	  BME_editmesh_to_bmesh(&bob);	  
+  }
+
+  virtual ~FooTest() {
+    // You can do clean-up work that doesn't throw exceptions here.
+  }
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+
+  virtual void SetUp() {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+  }
+
+  virtual void TearDown() {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+  }
+
+  // Objects declared here can be used by all tests in the test case for Foo.
+};
+
+// Tests that the Foo::Bar() method does Abc.
+TEST_F(FooTest, MethodBarDoesAbc) {
+  EXPECT_EQ(0, 0);
+}
+
+// Tests that Foo does Xyz.
+TEST_F(FooTest, DoesXyz) {
+  // Exercises the Xyz feature of Foo.
+}
+
+}  // namespace
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}

Added: branches/soc-2010-leifandersen/tests/gtest/secondtest.c
===================================================================
--- branches/soc-2010-leifandersen/tests/gtest/secondtest.c	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/gtest/secondtest.c	2010-05-17 00:10:16 UTC (rev 28799)
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "BKE_bmesh.h"
+
+
+int main() {
+	printf("Hello World!\n");
+	
+	EditMesh bob;
+	BME_editmesh_to_bmesh(&bob);
+	return 0;
+}





More information about the Bf-blender-cvs mailing list