summaryrefslogtreecommitdiff
path: root/morphlib/util_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-10-19 15:15:35 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-10-19 15:15:35 +0100
commit263750ef9caf3c591eba8685b7fff00eb66ee41a (patch)
treeb79094c4e40d6c74d5f65e36e62a78f2c379efad /morphlib/util_tests.py
parent04b37aca13ac899bede40bfef19e5c2e1230a75f (diff)
downloadmorph-263750ef9caf3c591eba8685b7fff00eb66ee41a.tar.gz
Add method for deciding how many concurrent make jobs to run.
Diffstat (limited to 'morphlib/util_tests.py')
-rw-r--r--morphlib/util_tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py
index 6637f571..e65d4507 100644
--- a/morphlib/util_tests.py
+++ b/morphlib/util_tests.py
@@ -42,3 +42,18 @@ class IndentTests(unittest.TestCase):
self.assertEqual(morphlib.util.indent('foo\nbar\n'),
' foo\n bar')
+
+class MakeConcurrencyTests(unittest.TestCase):
+
+ def test_returns_2_for_1_core(self):
+ self.assertEqual(morphlib.util.make_concurrency(cores=1), 2)
+
+ def test_returns_3_for_2_cores(self):
+ self.assertEqual(morphlib.util.make_concurrency(cores=2), 3)
+
+ def test_returns_5_for_3_cores(self):
+ self.assertEqual(morphlib.util.make_concurrency(cores=3), 5)
+
+ def test_returns_6_for_4_cores(self):
+ self.assertEqual(morphlib.util.make_concurrency(cores=4), 6)
+