summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/gras/CMakeLists.txt5
-rw-r--r--python/gras/GRAS_HierBlock.i (renamed from python/gras/GRASElements.i)0
-rw-r--r--python/gras/GRAS_ThreadPool.i25
-rw-r--r--python/gras/__init__.py3
-rw-r--r--tests/CMakeLists.txt3
-rw-r--r--tests/hier_block_test.py (renamed from tests/import_test.py)9
-rw-r--r--tests/thread_pool_test.py22
7 files changed, 56 insertions, 11 deletions
diff --git a/python/gras/CMakeLists.txt b/python/gras/CMakeLists.txt
index 5386096..61e1ba5 100644
--- a/python/gras/CMakeLists.txt
+++ b/python/gras/CMakeLists.txt
@@ -17,9 +17,10 @@ list(APPEND GR_SWIG_INCLUDE_DIRS ${GRAS_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
set(GR_SWIG_LIBRARIES gras)
-GR_SWIG_MAKE(GRASElements GRASElements.i)
+GR_SWIG_MAKE(GRAS_HierBlock GRAS_HierBlock.i)
+GR_SWIG_MAKE(GRAS_ThreadPool GRAS_ThreadPool.i)
GR_SWIG_INSTALL(
- TARGETS GRASElements
+ TARGETS GRAS_HierBlock GRAS_ThreadPool
DESTINATION ${GR_PYTHON_DIR}/gras
COMPONENT ${GRAS_COMP_PYTHON}
)
diff --git a/python/gras/GRASElements.i b/python/gras/GRAS_HierBlock.i
index 413ee2a..413ee2a 100644
--- a/python/gras/GRASElements.i
+++ b/python/gras/GRAS_HierBlock.i
diff --git a/python/gras/GRAS_ThreadPool.i b/python/gras/GRAS_ThreadPool.i
new file mode 100644
index 0000000..a50e8a8
--- /dev/null
+++ b/python/gras/GRAS_ThreadPool.i
@@ -0,0 +1,25 @@
+//
+// Copyright 2012 Josh Blum
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#define GRAS_API
+
+%{
+#include <gras/thread_pool.hpp>
+%}
+
+%include <std_string.i>
+
+%include <gras/thread_pool.hpp>
diff --git a/python/gras/__init__.py b/python/gras/__init__.py
index 6a836a6..595efeb 100644
--- a/python/gras/__init__.py
+++ b/python/gras/__init__.py
@@ -1 +1,2 @@
-from GRASElements import *
+from GRAS_HierBlock import *
+from GRAS_ThreadPool import *
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index be70903..6315014 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,4 +11,5 @@ list(APPEND GR_TEST_PYTHON_DIRS ${GRAS_SOURCE_DIR}/python)
list(APPEND GR_TEST_PYTHON_DIRS ${GRAS_BINARY_DIR}/python)
list(APPEND GR_TEST_PYTHON_DIRS ${GRAS_BINARY_DIR}/python/gras)
list(APPEND GR_TEST_PYTHON_DIRS ${GRAS_BINARY_DIR}/python/gras/${CMAKE_BUILD_TYPE})
-GR_ADD_TEST(import_test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/import_test.py)
+GR_ADD_TEST(hier_block ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/hier_block_test.py)
+GR_ADD_TEST(thread_pool ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/thread_pool_test.py)
diff --git a/tests/import_test.py b/tests/hier_block_test.py
index 4ccd00e..78bb1a0 100644
--- a/tests/import_test.py
+++ b/tests/hier_block_test.py
@@ -1,23 +1,18 @@
import unittest
+import gras
-class ImportTest(unittest.TestCase):
-
- def test_import(self):
- import gras
+class HierBlockTest(unittest.TestCase):
def test_expected_attrs(self):
- import gras
self.assertTrue(hasattr(gras, 'HierBlock'))
self.assertTrue(hasattr(gras, 'TopBlock'))
def test_make_hier(self):
- import gras
h = gras.HierBlock('my_hb')
print h
def test_make_top(self):
- import gras
t = gras.TopBlock('my_tb')
print t
diff --git a/tests/thread_pool_test.py b/tests/thread_pool_test.py
new file mode 100644
index 0000000..4ddc60d
--- /dev/null
+++ b/tests/thread_pool_test.py
@@ -0,0 +1,22 @@
+
+import unittest
+import gras
+
+class ThreadPoolTest(unittest.TestCase):
+
+ def test_make_config(self):
+ c = gras.ThreadPoolConfig()
+ print c.thread_count
+ print c.yield_strategy
+
+ def test_make_tp(self):
+ c = gras.ThreadPoolConfig()
+ tp = gras.ThreadPool(c)
+
+ def test_make_tp_set_active(self):
+ c = gras.ThreadPoolConfig()
+ tp = gras.ThreadPool(c)
+ tp.set_active()
+
+if __name__ == '__main__':
+ unittest.main()