1# encoding: utf-8
2
3import lldb
4from lldbsuite.test.decorators import *
5from lldbsuite.test.lldbtest import *
6from lldbsuite.test import lldbutil
7
8
9class CMTimeDataFormatterTestCase(TestBase):
10
11    @skipUnlessDarwin
12    def test_nsindexpath_with_run_command(self):
13        """Test formatters for CMTime."""
14        self.build()
15        self.runCmd("file " + self.getBuildArtifact("a.out"),
16                    CURRENT_EXECUTABLE_SET)
17
18        line = line_number('main.m', '// break here')
19        lldbutil.run_break_set_by_file_and_line(
20            self, "main.m", line, num_expected_locations=1, loc_exact=True)
21
22        self.runCmd("run", RUN_SUCCEEDED)
23
24        self.expect(
25            "thread list",
26            STOPPED_DUE_TO_BREAKPOINT,
27            substrs=['stopped', 'stop reason = breakpoint'])
28
29        self.expect(
30            'frame variable t1',
31            substrs=[
32                '1 half seconds', 'value = 1', 'timescale = 2', 'epoch = 0'
33            ])
34        self.expect(
35            'frame variable t2',
36            substrs=[
37                '1 third of a second', 'value = 1', 'timescale = 3',
38                'epoch = 0'
39            ])
40        self.expect(
41            'frame variable t3',
42            substrs=[
43                '1 10th of a second', 'value = 1', 'timescale = 10',
44                'epoch = 0'
45            ])
46        self.expect(
47            'frame variable t4',
48            substrs=['10 seconds', 'value = 10', 'timescale = 1', 'epoch = 0'])
49        self.expect('frame variable t5', substrs=['+oo'])
50        self.expect('frame variable t6', substrs=['-oo'])
51        self.expect('frame variable t7', substrs=['indefinite'])
52