diff options
| author | Stefan Behnel <stefan_ml@behnel.de> | 2017-08-17 13:38:47 +0200 |
|---|---|---|
| committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-08-17 13:38:47 +0200 |
| commit | 8c55949339b2292f226bcbe1ea0b06a209fe85af (patch) | |
| tree | 6f2643a30449d976ccc62efabe378ee16e52a5d1 /Cython/Compiler/Tests | |
| parent | 3c970eed3d25ef832292e524b6f8170aab950a39 (diff) | |
| download | cython-8c55949339b2292f226bcbe1ea0b06a209fe85af.tar.gz | |
Add some basic tests for PyrexTypes.widest_numeric_type().
Diffstat (limited to 'Cython/Compiler/Tests')
| -rw-r--r-- | Cython/Compiler/Tests/TestTypes.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Cython/Compiler/Tests/TestTypes.py b/Cython/Compiler/Tests/TestTypes.py new file mode 100644 index 000000000..f2f6f3773 --- /dev/null +++ b/Cython/Compiler/Tests/TestTypes.py @@ -0,0 +1,19 @@ +from __future__ import absolute_import + +import unittest + +import Cython.Compiler.PyrexTypes as PT + + +class TestMethodDispatcherTransform(unittest.TestCase): + + def test_widest_numeric_type(self): + def assert_widest(type1, type2, widest): + self.assertEqual(widest, PT.widest_numeric_type(type1, type2)) + + assert_widest(PT.c_int_type, PT.c_long_type, PT.c_long_type) + assert_widest(PT.c_double_type, PT.c_long_type, PT.c_double_type) + assert_widest(PT.c_longdouble_type, PT.c_long_type, PT.c_longdouble_type) + + cenum = PT.CEnumType("E", "cenum", typedef_flag=False) + assert_widest(PT.c_int_type, cenum, PT.c_int_type) |
