summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-10-13 22:17:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-10-13 22:21:21 (GMT)
commit601b8149bf81231a09e2977dbdbfe8e8e568c1f4 (patch)
tree9cf7c0e3b6398b4ad24880b3dcd26ef9b013a7fe /tests
parent362ff8ddd7fac8a10c7cccae303d2ce5ea6dd7f2 (diff)
Defined proper Python bindings for class/enum types.
Diffstat (limited to 'tests')
-rw-r--r--tests/analysis/types/basic.py4
-rw-r--r--tests/analysis/types/cse.py30
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/analysis/types/basic.py b/tests/analysis/types/basic.py
index 7b7403b..65700bd 100644
--- a/tests/analysis/types/basic.py
+++ b/tests/analysis/types/basic.py
@@ -6,8 +6,8 @@ from chrysacase import ChrysalideTestCase
from pychrysalide.analysis.types import BasicType
-class TestDataType(ChrysalideTestCase):
- """TestCase for analysis.DataType."""
+class TestBasicType(ChrysalideTestCase):
+ """TestCase for analysis.BasicType."""
def testBasicTypeConstructor(self):
diff --git a/tests/analysis/types/cse.py b/tests/analysis/types/cse.py
new file mode 100644
index 0000000..9b6b016
--- /dev/null
+++ b/tests/analysis/types/cse.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python3-dbg
+# -*- coding: utf-8 -*-
+
+
+from chrysacase import ChrysalideTestCase
+from pychrysalide.analysis.types import ClassEnumType
+
+
+class TestClassEnumType(ChrysalideTestCase):
+ """TestCase for analysis.ClassEnumType."""
+
+
+ def testClassEnumTypeConstructor(self):
+ """Build some class/enum types."""
+
+ tp = ClassEnumType(ClassEnumType.ClassEnumKind.STRUCT)
+
+ self.assertEqual(str(tp), '')
+
+ tp = ClassEnumType(ClassEnumType.ClassEnumKind.STRUCT, 'XXX')
+
+ self.assertEqual(str(tp), 'XXX')
+
+ with self.assertRaisesRegex(TypeError, 'Bad class/enum kind.'):
+
+ tp = ClassEnumType(ClassEnumType.ClassEnumKind.COUNT)
+
+ with self.assertRaisesRegex(TypeError, 'invalid value for ClassEnumKind'):
+
+ tp = ClassEnumType(0x1234)