42e5f8d8c4307ccb7837977586f66e0f2e3c82d0
[openbsd] /
1 """
2 Tests std::queue functionality.
3 """
4
5 from lldbsuite.test.decorators import *
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test import lldbutil
8
9 class TestQueue(TestBase):
10
11     mydir = TestBase.compute_mydir(__file__)
12
13     @add_test_categories(["libc++"])
14     @skipIf(compiler=no_match("clang"))
15     def test(self):
16         self.build()
17
18         lldbutil.run_to_source_breakpoint(self,
19             "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
20
21         self.runCmd("settings set target.import-std-module true")
22
23         # Test std::queue functionality with a std::deque.
24         self.expect("expr q_deque.pop()")
25         self.expect("expr q_deque.push({4})")
26         self.expect("expr (size_t)q_deque.size()", substrs=['(size_t) $0 = 1'])
27         self.expect("expr (int)q_deque.front().i", substrs=['(int) $1 = 4'])
28         self.expect("expr (int)q_deque.back().i", substrs=['(int) $2 = 4'])
29         self.expect("expr q_deque.empty()", substrs=['(bool) $3 = false'])
30         self.expect("expr q_deque.pop()")
31         self.expect("expr q_deque.emplace(5)")
32         self.expect("expr (int)q_deque.front().i", substrs=['(int) $4 = 5'])
33
34         # Test std::queue functionality with a std::list.
35         self.expect("expr q_list.pop()")
36         self.expect("expr q_list.push({4})")
37         self.expect("expr (size_t)q_list.size()", substrs=['(size_t) $5 = 1'])
38         self.expect("expr (int)q_list.front().i", substrs=['(int) $6 = 4'])
39         self.expect("expr (int)q_list.back().i", substrs=['(int) $7 = 4'])
40         self.expect("expr q_list.empty()", substrs=['(bool) $8 = false'])
41         self.expect("expr q_list.pop()")
42         self.expect("expr q_list.emplace(5)")
43         self.expect("expr (int)q_list.front().i", substrs=['(int) $9 = 5'])