blob: 9b6b016df48b2b0eac0ae80560e90d3ddb81ca40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
|