diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-10-13 21:24:12 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-10-13 21:24:12 (GMT) |
commit | 362ff8ddd7fac8a10c7cccae303d2ce5ea6dd7f2 (patch) | |
tree | 5994c98dd314333be5d1a7cbf34ccec93efba83e /tests | |
parent | 15ca338693167373102f5a44c2694c0adc26d820 (diff) |
Defined proper Python bindings for basic types.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/analysis/types/basic.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/analysis/types/basic.py b/tests/analysis/types/basic.py new file mode 100644 index 0000000..7b7403b --- /dev/null +++ b/tests/analysis/types/basic.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3-dbg +# -*- coding: utf-8 -*- + + +from chrysacase import ChrysalideTestCase +from pychrysalide.analysis.types import BasicType + + +class TestDataType(ChrysalideTestCase): + """TestCase for analysis.DataType.""" + + + def testBasicTypeConstructor(self): + """Build some basic types.""" + + tp = BasicType(BasicType.BaseType.VOID) + + self.assertEqual(str(tp), 'void') + + self.assertEqual(tp.base, BasicType.BaseType.VOID) + + with self.assertRaisesRegex(TypeError, 'Bad basic type.'): + + tp = BasicType(BasicType.BaseType.INVALID) + + with self.assertRaisesRegex(TypeError, 'invalid value for BaseType'): + + tp = BasicType(0x1234) |