aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/python_unittests.py
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-10-19 10:18:52 +0200
committerSimon Warta <[email protected]>2017-10-19 10:38:53 +0200
commit5b3696864396ab24c2da47106721cf25721a4468 (patch)
tree270b10da32f8a1d6b268d60756266270252588ca /src/scripts/python_unittests.py
parentc4ba92a457825276340eb448528d6d5a09e18009 (diff)
Rename method to AmalgamationHelper.is_unconditional_std_include and test
Diffstat (limited to 'src/scripts/python_unittests.py')
-rwxr-xr-xsrc/scripts/python_unittests.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/scripts/python_unittests.py b/src/scripts/python_unittests.py
index 37068ed1c..37fa25721 100755
--- a/src/scripts/python_unittests.py
+++ b/src/scripts/python_unittests.py
@@ -14,9 +14,43 @@ import sys
import unittest
sys.path.append("../..") # Botan repo root
+from configure import AmalgamationHelper # pylint: disable=wrong-import-position
from configure import CompilerDetector # pylint: disable=wrong-import-position
from configure import ModulesChooser # pylint: disable=wrong-import-position
+class AmalgamationHelperTests(unittest.TestCase):
+ def test_matcher_std_includes(self):
+ self.assertEqual(AmalgamationHelper.is_unconditional_std_include("#include <string>"), "string")
+
+ self.assertEqual(AmalgamationHelper.is_unconditional_std_include("#include <myfile.h>"), None)
+ self.assertEqual(AmalgamationHelper.is_unconditional_std_include("#include <unistd.h>"), None)
+ self.assertEqual(AmalgamationHelper.is_unconditional_std_include(" #include <string>"), None)
+
+ def test_matcher_botan_include(self):
+ self.assertEqual(AmalgamationHelper.is_botan_include("#include <botan/oids.h>"),
+ "oids.h")
+ self.assertEqual(AmalgamationHelper.is_botan_include("#include <botan/internal/socket.h>"),
+ "internal/socket.h")
+ self.assertEqual(AmalgamationHelper.is_botan_include(" #include <botan/oids.h>"),
+ "oids.h")
+ self.assertEqual(AmalgamationHelper.is_botan_include(" #include <botan/internal/socket.h>"),
+ "internal/socket.h")
+
+ self.assertEqual(AmalgamationHelper.is_botan_include("#include <string>"), None)
+ self.assertEqual(AmalgamationHelper.is_botan_include("#include <myfile.h>"), None)
+ self.assertEqual(AmalgamationHelper.is_botan_include("#include <unistd.h>"), None)
+
+ def test_matcher_any_includes(self):
+ self.assertEqual(AmalgamationHelper.is_any_include("#include <string>"), "string")
+ self.assertEqual(AmalgamationHelper.is_any_include("#include <myfile.h>"), "myfile.h")
+ self.assertEqual(AmalgamationHelper.is_any_include("#include <unistd.h>"), "unistd.h")
+ self.assertEqual(AmalgamationHelper.is_any_include("#include <botan/oids.h>"),
+ "botan/oids.h")
+ self.assertEqual(AmalgamationHelper.is_any_include(" #include <string>"), "string")
+ self.assertEqual(AmalgamationHelper.is_any_include(" #include <myfile.h>"), "myfile.h")
+ self.assertEqual(AmalgamationHelper.is_any_include(" #include <unistd.h>"), "unistd.h")
+ self.assertEqual(AmalgamationHelper.is_any_include(" #include <botan/oids.h>"),
+ "botan/oids.h")
class CompilerDetection(unittest.TestCase):