diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-02 16:47:55 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-02 16:47:55 -0400 |
| commit | 3ced5b0da2d0bb0498858553acefd09e347c1665 (patch) | |
| tree | 2a13e30372ce08fd5c5569f07918decb80f0f935 /src | |
| parent | 510af4dadbb33997bab589740ca111cb2a9a7f99 (diff) | |
| download | rust-3ced5b0da2d0bb0498858553acefd09e347c1665.tar.gz rust-3ced5b0da2d0bb0498858553acefd09e347c1665.zip | |
add dlist.rs should_fail tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/dlist.rs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 0ce40e99c4e..ba71e6b21ca 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -590,4 +590,54 @@ mod tests { l.assert_consistent(); assert l.pop().get() == 3; l.assert_consistent(); assert l.is_empty(); } + #[test] #[should_fail] + fn test_asymmetric_link() { + let l = create::<int>(); + let one = l.push_n(1); + let two = l.push_n(2); + two.prev = none; + l.assert_consistent(); + } + #[test] #[should_fail] + fn test_cyclic_list() { + let l = create::<int>(); + let one = l.push_n(1); + let _two = l.push_n(2); + let three = l.push_n(3); + three.next = some(one); + one.prev = some(three); + l.assert_consistent(); + } + #[test] #[should_fail] + fn test_headless() { + create::<int>().head(); + } + #[test] #[should_fail] + fn test_insert_already_present_before() { + let l = create::<int>(); + let one = l.push_n(1); + let two = l.push_n(2); + l.insert_n_before(two, one); + } + #[test] #[should_fail] + fn test_insert_already_present_after() { + let l = create::<int>(); + let one = l.push_n(1); + let two = l.push_n(2); + l.insert_n_after(one, two); + } + #[test] #[should_fail] + fn test_insert_before_orphan() { + let l = create::<int>(); + let one = create_node(1); + let two = create_node(2); + l.insert_n_before(one, two); + } + #[test] #[should_fail] + fn test_insert_after_orphan() { + let l = create::<int>(); + let one = create_node(1); + let two = create_node(2); + l.insert_n_after(two, one); + } } |
