2018-11-21 18:35:49 +00:00
|
|
|
// ignore-tidy-linelength
|
2018-08-07 13:05:32 +00:00
|
|
|
// ignore-windows failing on win32 bot
|
|
|
|
// ignore-freebsd: gdb package too new
|
|
|
|
// ignore-android: FIXME(#10381)
|
|
|
|
// compile-flags:-g
|
2018-12-12 22:00:59 +00:00
|
|
|
|
|
|
|
// The pretty printers being tested here require the patch from
|
|
|
|
// https://sourceware.org/bugzilla/show_bug.cgi?id=21763
|
|
|
|
// min-gdb-version 8.1
|
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
// min-lldb-version: 310
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command: run
|
|
|
|
|
|
|
|
// gdb-command: print btree_set
|
2018-11-21 18:35:49 +00:00
|
|
|
// gdb-check:$1 = BTreeSet<i32>(len: 15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
|
2018-08-07 13:05:32 +00:00
|
|
|
|
2020-03-18 19:29:05 +00:00
|
|
|
// gdb-command: print empty_btree_set
|
|
|
|
// gdb-check:$2 = BTreeSet<i32>(len: 0)
|
|
|
|
|
2018-08-14 16:38:00 +00:00
|
|
|
// gdb-command: print btree_map
|
2020-03-18 19:29:05 +00:00
|
|
|
// gdb-check:$3 = BTreeMap<i32, i32>(len: 15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}
|
|
|
|
|
|
|
|
// gdb-command: print empty_btree_map
|
|
|
|
// gdb-check:$4 = BTreeMap<i32, u32>(len: 0)
|
2018-08-14 16:38:00 +00:00
|
|
|
|
2020-01-10 16:31:56 +00:00
|
|
|
// gdb-command: print nasty_btree_map
|
|
|
|
// gdb-check:$5 = BTreeMap<i32, pretty_std_collections::MyLeafNode>(len: 1) = {[1] = pretty_std_collections::MyLeafNode (11)}
|
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
// gdb-command: print vec_deque
|
2020-01-10 16:31:56 +00:00
|
|
|
// gdb-check:$6 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7}
|
2018-08-07 13:05:32 +00:00
|
|
|
|
2018-11-14 23:22:14 +00:00
|
|
|
// gdb-command: print vec_deque2
|
2020-01-10 16:31:56 +00:00
|
|
|
// gdb-check:$7 = VecDeque<i32>(len: 7, cap: 8) = {2, 3, 4, 5, 6, 7, 8}
|
2018-11-14 23:22:14 +00:00
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
#![allow(unused_variables)]
|
2018-08-14 16:38:00 +00:00
|
|
|
use std::collections::BTreeMap;
|
2020-03-18 19:29:05 +00:00
|
|
|
use std::collections::BTreeSet;
|
2018-08-07 13:05:32 +00:00
|
|
|
use std::collections::VecDeque;
|
|
|
|
|
2020-01-10 16:31:56 +00:00
|
|
|
struct MyLeafNode(i32); // helps to ensure we don't blindly replace substring "LeafNode"
|
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
fn main() {
|
|
|
|
// BTreeSet
|
|
|
|
let mut btree_set = BTreeSet::new();
|
2018-11-21 18:35:49 +00:00
|
|
|
for i in 0..15 {
|
|
|
|
btree_set.insert(i);
|
|
|
|
}
|
2018-08-07 13:05:32 +00:00
|
|
|
|
2020-03-18 19:29:05 +00:00
|
|
|
let mut empty_btree_set: BTreeSet<i32> = BTreeSet::new();
|
|
|
|
|
2018-08-14 16:38:00 +00:00
|
|
|
// BTreeMap
|
|
|
|
let mut btree_map = BTreeMap::new();
|
2018-11-21 18:35:49 +00:00
|
|
|
for i in 0..15 {
|
|
|
|
btree_map.insert(i, i);
|
|
|
|
}
|
2018-08-14 16:38:00 +00:00
|
|
|
|
2020-03-18 19:29:05 +00:00
|
|
|
let mut empty_btree_map: BTreeMap<i32, u32> = BTreeMap::new();
|
|
|
|
|
2020-01-10 16:31:56 +00:00
|
|
|
let mut nasty_btree_map: BTreeMap<i32, MyLeafNode> = BTreeMap::new();
|
|
|
|
nasty_btree_map.insert(1, MyLeafNode(11));
|
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
// VecDeque
|
|
|
|
let mut vec_deque = VecDeque::new();
|
|
|
|
vec_deque.push_back(5);
|
|
|
|
vec_deque.push_back(3);
|
|
|
|
vec_deque.push_back(7);
|
|
|
|
|
2018-11-14 23:22:14 +00:00
|
|
|
// VecDeque where an element was popped.
|
|
|
|
let mut vec_deque2 = VecDeque::new();
|
|
|
|
for i in 1..8 {
|
|
|
|
vec_deque2.push_back(i)
|
|
|
|
}
|
|
|
|
vec_deque2.pop_front();
|
|
|
|
vec_deque2.push_back(8);
|
|
|
|
|
2018-08-07 13:05:32 +00:00
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2020-03-18 19:29:05 +00:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|