1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    @no_debug_info_test
11    @skipIfWindows
12    def test(self):
13        self.build()
14        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
15
16        self.expect_expr("complex_float", result_type="_Complex float", result_value="-1.5 + -2.5i")
17        self.expect_expr("complex_float + (2.0f + 3.5fi)", result_type="_Complex float", result_value="0.5 + 1i")
18
19        self.expect_expr("complex_double", result_type="_Complex double", result_value="-1.5 + -2.5i")
20        self.expect_expr("complex_double + (2.0 + 3.5i)", result_type="_Complex double", result_value="0.5 + 1i")
21
22    @no_debug_info_test
23    # FIXME: LLDB fails to read the imaginary part of the number.
24    @expectedFailureAll()
25    @skipIfWindows
26    def test_long_double(self):
27        self.build()
28        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
29
30        self.expect_expr("complex_long_double", result_type="_Complex long double", result_value="-1.5 + 1i")
31        self.expect_expr("complex_long_double + (2.0L + 3.5Li)", result_type="_Complex long double", result_value="0.5 + 1i")
32