diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2023-02-14 16:00:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2023-02-14 16:00:13 +0900 |
commit | 740f8d788d1494e6ce5b29a307a9597a5baa2391 (patch) | |
tree | 4b3b57a882bf61f08559f330b534cc294779231d /tests/debugger_visualizer.rs | |
download | rust-smallvec-740f8d788d1494e6ce5b29a307a9597a5baa2391.tar.gz rust-smallvec-740f8d788d1494e6ce5b29a307a9597a5baa2391.tar.bz2 rust-smallvec-740f8d788d1494e6ce5b29a307a9597a5baa2391.zip |
Import smallvec 1.10.0upstream/1.10.0upstream
Diffstat (limited to 'tests/debugger_visualizer.rs')
-rw-r--r-- | tests/debugger_visualizer.rs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/debugger_visualizer.rs b/tests/debugger_visualizer.rs new file mode 100644 index 0000000..210f539 --- /dev/null +++ b/tests/debugger_visualizer.rs @@ -0,0 +1,68 @@ +use debugger_test::debugger_test; +use smallvec::{smallvec, SmallVec}; + +#[inline(never)] +fn __break() {} + +#[debugger_test( + debugger = "cdb", + commands = r#" +.nvlist +dx sv + +g + +dx sv + +g + +dx sv +"#, + expected_statements = r#" +sv : { len=0x2 } [Type: smallvec::SmallVec<array$<i32,4> >] + [<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] + [capacity] : 4 + [len] : 0x2 [Type: unsigned __int64] + [0] : 1 [Type: int] + [1] : 2 [Type: int] + +sv : { len=0x5 } [Type: smallvec::SmallVec<array$<i32,4> >] + [<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] + [capacity] : 0x8 [Type: unsigned __int64] + [len] : 0x5 [Type: unsigned __int64] + [0] : 5 [Type: int] + [1] : 2 [Type: int] + [2] : 3 [Type: int] + [3] : 4 [Type: int] + [4] : 5 [Type: int] + +sv : { len=0x5 } [Type: smallvec::SmallVec<array$<i32,4> >] + [<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] + [capacity] : 0x8 [Type: unsigned __int64] + [len] : 0x5 [Type: unsigned __int64] + [0] : 2 [Type: int] + [1] : 3 [Type: int] + [2] : 4 [Type: int] + [3] : 5 [Type: int] + [4] : 5 [Type: int] +"# +)] +#[inline(never)] +fn test_debugger_visualizer() { + // This SmallVec can hold up to 4 items on the stack: + let mut sv: SmallVec<[i32; 4]> = smallvec![1, 2]; + __break(); + + // Overfill the SmallVec to move its contents to the heap + for i in 3..6 { + sv.push(i); + } + + // Update the contents of the first value of the SmallVec. + sv[0] = sv[1] + sv[2]; + __break(); + + // Sort the SmallVec in place. + sv.sort(); + __break(); +} |