Test the deque a bit. Give it a get-by-index method. Fix two uncovered state-calculation bugs --- one decently, the other with an ugly hack. Bug on the latter coming right up.

This commit is contained in:
Roy Frostig 2010-07-28 14:00:44 -07:00
parent 8030757624
commit 596d19e2ea
7 changed files with 65 additions and 8 deletions

View file

@ -0,0 +1,17 @@
// -*- rust -*-
use std;
import std.deque;
fn main() {
let deque.t[int] d1 = deque.create[int]();
check (d1.size() == 0u);
d1.add_front(17);
d1.add_front(42);
d1.add_back(137);
check (d1.size() == 3u);
d1.add_back(137);
check (d1.size() == 4u);
/* FIXME (issue #133): We should check that the numbers come back
* to us correctly once the deque stops zeroing them out. */
}