diff options
Diffstat (limited to 'tests/analysis')
-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) |