Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / c / complex_int / TestComplexInt.py
blob4f48e0dc6e10f58781dd1ecb45fa585c698323fb
1 """
2 Tests GCC's complex integer types.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
11 class TestCase(TestBase):
12 @no_debug_info_test
13 @skipIfWindows
14 def test(self):
15 self.build()
16 lldbutil.run_to_source_breakpoint(
17 self, "// break here", lldb.SBFileSpec("main.c")
20 long_size_eq_int = self.frame().EvaluateExpression(
21 "sizeof(long) == sizeof(int)"
24 # FIXME: LLDB treats all complex ints as unsigned, so the value is wrong.
25 self.expect_expr(
26 "complex_int",
27 result_type="_Complex int",
28 result_value="4294967295 + 4294967294i",
30 self.expect_expr(
31 "complex_unsigned", result_type="_Complex int", result_value="1 + 2i"
34 # FIXME: We get the type wrong if long has the same size as int.
35 if long_size_eq_int.GetValue() == "true":
36 self.expect_expr("complex_long", result_type="_Complex int")
37 self.expect_expr(
38 "complex_unsigned_long",
39 result_type="_Complex int",
40 result_value="1 + 2i",
42 else:
43 self.expect_expr("complex_long", result_type="_Complex long")
44 self.expect_expr(
45 "complex_unsigned_long",
46 result_type="_Complex long",
47 result_value="1 + 2i",
50 @no_debug_info_test
51 @skipIfWindows
52 def test_long_long(self):
53 self.build()
54 lldbutil.run_to_source_breakpoint(
55 self, "// break here", lldb.SBFileSpec("main.c")
58 # FIXME: We get the type wrong if long has the same size as long long.
59 # FIXME: LLDB treats all complex ints as unsigned, so the value is wrong.
60 long_size_eq_long_long = self.frame().EvaluateExpression(
61 "sizeof(long) == sizeof(long long)"
63 if long_size_eq_long_long.GetValue() == "true":
64 self.expect_expr("complex_long_long", result_type="_Complex long")
65 self.expect_expr(
66 "complex_unsigned_long_long",
67 result_type="_Complex long",
68 result_value="1 + 2i",
70 else:
71 self.expect_expr("complex_long_long", result_type="_Complex long long")
72 self.expect_expr(
73 "complex_unsigned_long_long",
74 result_type="_Complex long long",
75 result_value="1 + 2i",