1"""
2Test that variables of floating point types are displayed correctly.
3"""
4
5import AbstractBase
6import unittest2
7import lldb
8import sys
9from lldbtest import dsym_test, dwarf_test
10
11class FloatTypesTestCase(AbstractBase.GenericTester):
12
13    mydir = "types"
14
15    def setUp(self):
16        # Call super's setUp().
17        AbstractBase.GenericTester.setUp(self)
18        # disable "There is a running process, kill it and restart?" prompt
19        self.runCmd("settings set auto-confirm true")
20        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
21
22    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
23    @dsym_test
24    def test_float_type_with_dsym(self):
25        """Test that float-type variables are displayed correctly."""
26        self.build_and_run('float.cpp', set(['float']))
27
28    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
29    @dsym_test
30    def test_float_type_from_block_with_dsym(self):
31        """Test that float-type variables are displayed correctly from a block."""
32        self.build_and_run('float.cpp', set(['float']), bc=True)
33
34    @dwarf_test
35    def test_float_type_with_dwarf(self):
36        """Test that float-type variables are displayed correctly."""
37        self.build_and_run('float.cpp', set(['float']), dsym=False)
38
39    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
40    @dsym_test
41    def test_double_type_with_dsym(self):
42        """Test that double-type variables are displayed correctly."""
43        self.build_and_run('double.cpp', set(['double']))
44
45    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
46    @dsym_test
47    def test_double_type_from_block_with_dsym(self):
48        """Test that double-type variables are displayed correctly from a block."""
49        self.build_and_run('double.cpp', set(['double']), bc=True)
50
51    @dwarf_test
52    def test_double_type_with_dwarf(self):
53        """Test that double-type variables are displayed correctly."""
54        self.build_and_run('double.cpp', set(['double']), dsym=False)
55
56
57if __name__ == '__main__':
58    import atexit
59    lldb.SBDebugger.Initialize()
60    atexit.register(lambda: lldb.SBDebugger.Terminate())
61    unittest2.main()
62