[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29048] branches/soc-2010-leifandersen: 1.

Leif Andersen leif.a.andersen at gmail.com
Fri May 28 18:33:44 CEST 2010


Revision: 29048
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29048
Author:   leifandersen
Date:     2010-05-28 18:33:44 +0200 (Fri, 28 May 2010)

Log Message:
-----------
1.  Improved the functionality of the tests module:
	i.  There is now two other submodules, for a total of 3, tests.scenes tests.meshes and tests.objects
	ii.  import tests  will now import the other submodules, you no longer need to import them seperatly (I think).
	iii.  Scene_Hash.py has been removed, making it more clear when calling upon the module
	NOTE: The module still isn't imported by default, import tests must still be an in the python shell/script also the WITH_TESTS flag in CMake won't make a different whether or not python scripts are copied to the binary directory.

2.  Started adding GPL clauses to the top of code, mainly copy/pasta from other code blocks, hopefully the work. (I didn't change the copyright date, but I did change the Original Code: and Contributors: tags as appropriate.  Also, I'm hoping that the top line of the coopyright statement in the C files is automatically managed by SVN, otherwise I may have done that incorrectly.

3.  The Gtest test works, using roundf combined with multiplication and division.

4.  A PyUnit based hash test has been added.  Also, it is ran and checked by default with CTest.  Currently it is using hashes found by running it once, I hope to update it to allow for easy changing of the hash codes.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py
    branches/soc-2010-leifandersen/tests/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/gtest/blenlib/BLI_math_base_test.cpp
    branches/soc-2010-leifandersen/tests/pyunit/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2010-leifandersen/release/scripts/modules/tests/meshes.py
    branches/soc-2010-leifandersen/release/scripts/modules/tests/objects.py
    branches/soc-2010-leifandersen/release/scripts/modules/tests/scenes.py
    branches/soc-2010-leifandersen/tests/hashtests/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/hashtests/scenes.py

Removed Paths:
-------------
    branches/soc-2010-leifandersen/release/scripts/modules/tests/Scene_Hash.py

Deleted: branches/soc-2010-leifandersen/release/scripts/modules/tests/Scene_Hash.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/Scene_Hash.py	2010-05-28 16:11:55 UTC (rev 29047)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/Scene_Hash.py	2010-05-28 16:33:44 UTC (rev 29048)
@@ -1,17 +0,0 @@
-def hashcode(scene):
-    hashcode = 0
-    hashcode += hash(scene.name)
-    for ob in scene.objects:
-        hashcode += hash(ob.name)
-        for num in ob.rotation_euler:
-            hashcode += hash(round(num, 6))
-        hashcode += hash(ob.type)
-        if ob.type == 'MESH':
-            for vert in ob.data.verts:
-                for co in vert.co:
-                    hashcode += hash(co)
-    return hashcode
-
-if __name__ == "__main__":
-    for scene in bpy.data.scenes:
-        print(scene.name+": "+str(hashcode(scene)))
\ No newline at end of file

Modified: branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py	2010-05-28 16:11:55 UTC (rev 29047)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py	2010-05-28 16:33:44 UTC (rev 29048)
@@ -0,0 +1,19 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  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 2
+#  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, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+from tests import scenes, objects, meshes

Added: branches/soc-2010-leifandersen/release/scripts/modules/tests/meshes.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/meshes.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/meshes.py	2010-05-28 16:33:44 UTC (rev 29048)
@@ -0,0 +1,24 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  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 2
+#  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, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+
+def reset_meshes():
+    while len(bpy.data.meshes) > 0:
+        bpy.data.meshes[0].user_clear()
+        bpy.data.meshes.remove(bpy.data.meshes[0])   

Added: branches/soc-2010-leifandersen/release/scripts/modules/tests/objects.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/objects.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/objects.py	2010-05-28 16:33:44 UTC (rev 29048)
@@ -0,0 +1,25 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  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 2
+#  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, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+
+import bpy
+
+def reset_objects():
+    while len(bpy.data.objects) > 0:
+        bpy.data.objects[0].user_clear()
+        bpy.data.objects.remove(bpy.data.objects[0])

Added: branches/soc-2010-leifandersen/release/scripts/modules/tests/scenes.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/scenes.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/scenes.py	2010-05-28 16:33:44 UTC (rev 29048)
@@ -0,0 +1,49 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  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 2
+#  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, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+
+# Generates a hashcode
+def hashcode(scene):
+    hashcode = 0
+    hashcode += hash(scene.name)
+    for ob in scene.objects:
+        hashcode += hash(ob.name)
+        for num in ob.rotation_euler:
+            hashcode += hash(round(num, 6))
+        hashcode += hash(ob.type)
+        if ob.type == 'MESH':
+            for vert in ob.data.verts:
+                for co in vert.co:
+                    hashcode += hash(co)
+    return hashcode
+
+
+# Assuming the default blend file, or a file that has only been modified by one of the
+# tests in this suite, it will clear all of the scenes, and create one that it calls "Test"
+def reset_scenes():
+    bpy.data.scenes.new("Test")
+    while len(bpy.data.scenes) > 1:
+        bpy.data.scenes.remove(bpy.data.scenes[0])
+    if bpy.data.scenes[0].name != "Test":
+        bpy.data.scenes.new("Test")
+        bpy.data.scenes.remove(bpy.data.scenes[1])
+
+if __name__ == "__main__":
+    for scene in bpy.data.scenes:
+        print(scene.name+": "+str(hashcode(scene)))

Modified: branches/soc-2010-leifandersen/tests/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/CMakeLists.txt	2010-05-28 16:11:55 UTC (rev 29047)
+++ branches/soc-2010-leifandersen/tests/CMakeLists.txt	2010-05-28 16:33:44 UTC (rev 29048)
@@ -1,5 +1,31 @@
+# $Id: CMakeLists.txt 28799 2010-05-17 00:10:16Z leifandersen $
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# 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 2
+# 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, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: some of this file.
+#
+# Contributor(s): Andrea Weikert, Leif Andersen.
+#
+# ***** END GPL LICENSE BLOCK *****
 ENABLE_TESTING()
 ADD_CUSTOM_TARGET(test COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS blender)
 
-add_subdirectory(gtest)
-add_subdirectory(pyunit)
+ADD_SUBDIRECTORY(gtest)
+ADD_SUBDIRECTORY(pyunit)
+ADD_SUBDIRECTORY(hashtests)

Modified: branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt	2010-05-28 16:11:55 UTC (rev 29047)
+++ branches/soc-2010-leifandersen/tests/gtest/CMakeLists.txt	2010-05-28 16:33:44 UTC (rev 29048)
@@ -1,3 +1,29 @@
+# $Id: CMakeLists.txt 28799 2010-05-17 00:10:16Z leifandersen $
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# 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 2
+# 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, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: some of this file.
+#
+# Contributor(s): Andrea Weikert, Leif Andersen.
+#
+# ***** END GPL LICENSE BLOCK *****
+
 CMAKE_POLICY(SET CMP0010 NEW)
 
 ADD_SUBDIRECTORY(blenlib)

Modified: branches/soc-2010-leifandersen/tests/gtest/blenlib/BLI_math_base_test.cpp
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list