forked from Lokathor/tinyvec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebugger_visualizer.rs
More file actions
91 lines (80 loc) · 2.8 KB
/
debugger_visualizer.rs
File metadata and controls
91 lines (80 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use debugger_test::debugger_test;
use tinyvec::*;
#[inline(never)]
fn __break() {
println!("breakpoint hit");
}
#[debugger_test(
debugger = "cdb",
commands = r#"
dx strings
dx inline_tv
dx inline_tv.__0
g
dx slice_vec
g
dx strings
"#,
expected_statements = r#"
strings : { len=0x3 } [Type: tinyvec::arrayvec::ArrayVec<array$<str,7> >]
[<Raw View>] [Type: tinyvec::arrayvec::ArrayVec<array$<str,7> >]
[len] : 0x3 [Type: unsigned short]
[capacity] : 7
[0] : "a" [Type: str]
[1] : "b" [Type: str]
[2] : "c" [Type: str]
inline_tv : Inline [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >]
[<Raw View>] [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >]
[+0x004] __0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
inline_tv.__0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
[<Raw View>] [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >]
[len] : 0x4 [Type: unsigned short]
[capacity] : 4
[0] : 1 [Type: i32]
[1] : 2 [Type: i32]
[2] : 3 [Type: i32]
[3] : 4 [Type: i32]
slice_vec : { len=0x3 } [Type: tinyvec::slicevec::SliceVec<str>]
[<Raw View>] [Type: tinyvec::slicevec::SliceVec<str>]
[len] : 0x3 [Type: unsigned __int64]
[0] : "a" [Type: str]
[1] : "b" [Type: str]
[2] : "d" [Type: str]
strings : { len=0x6 } [Type: tinyvec::arrayvec::ArrayVec<array$<str,7> >]
[<Raw View>] [Type: tinyvec::arrayvec::ArrayVec<array$<str,7> >]
[len] : 0x6 [Type: unsigned short]
[capacity] : 7
[0] : "a" [Type: str]
[1] : "b" [Type: str]
[2] : "d" [Type: str]
[3] : "e" [Type: str]
[4] : "f" [Type: str]
[5] : "g" [Type: str]
"#
)]
#[inline(never)]
fn test_debugger_visualizer() {
let mut strings = ArrayVec::<[&str; 7]>::default();
strings.push("a");
strings.push("b");
strings.push("c");
assert_eq!(["a", "b", "c"], &strings[..]);
let mut inline_tv = tiny_vec!([i32; 4] => 1, 2, 3);
assert!(inline_tv.is_inline());
inline_tv.push(4);
__break();
{
let mut slice_vec = SliceVec::from(strings.as_mut_slice());
assert_eq!(3, slice_vec.capacity());
assert_eq!("c", slice_vec.remove(2));
slice_vec.push("d");
println!("{:?}", slice_vec);
__break();
assert_eq!(["a", "b", "d"], &slice_vec[..]);
}
strings.push("e");
strings.push("f");
strings.push("g");
assert_eq!(["a", "b", "d", "e", "f", "g"], &strings[..]);
__break();
}