diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-06 22:13:13 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-06 22:51:19 +0200 |
| commit | a3ec0b1f643d00b9418e4884bd7caa07bf052201 (patch) | |
| tree | 82000510ac9c9cf3f0c7cf4ae5f3c6b123b559cb /src/test/run-pass | |
| parent | Register new snapshots. (diff) | |
| download | rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.tar.xz rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.zip | |
Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
Diffstat (limited to 'src/test/run-pass')
34 files changed, 438 insertions, 438 deletions
diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs index 152fac5d..8f45e6ff 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -1,10 +1,10 @@ use std; -import std.option; -import std.option.t; -import std.option.none; -import std.option.some; +import std.Option; +import std.Option.t; +import std.Option.none; +import std.Option.some; -fn foo[T](&option.t[T] y) { +fn foo[T](&Option.t[T] y) { let int x; let vec[int] res = vec(); diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index b92ffd74..76e7c3aa 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -1,9 +1,9 @@ // -*- rust -*- use std; -import std._str; +import std.Str; -// FIXME: import std.dbg.const_refcount. Currently +// FIXME: import std.Dbg.const_refcount. Currently // cross-crate const references don't work. const uint const_refcount = 0x7bad_face_u; @@ -20,13 +20,13 @@ fn foo(str s) { case (_) { log "?"; fail; } } - log _str.refcount(s); - assert (_str.refcount(s) == const_refcount); + log Str.refcount(s); + assert (Str.refcount(s) == const_refcount); } fn main() { let str s = "hi"; // ref up foo(s); // ref up then down - log _str.refcount(s); - assert (_str.refcount(s) == const_refcount); + log Str.refcount(s); + assert (Str.refcount(s) == const_refcount); } diff --git a/src/test/run-pass/lib-bitv.rs b/src/test/run-pass/lib-bitv.rs index 8f2d9390..b047f47a 100644 --- a/src/test/run-pass/lib-bitv.rs +++ b/src/test/run-pass/lib-bitv.rs @@ -1,132 +1,132 @@ use std; -import std._vec; -import std.bitv; +import std.Vec; +import std.BitV; fn test_0_elements() { auto act; auto exp; - act = bitv.create(0u, false); - exp = _vec.init_elt[uint](0u, 0u); + act = BitV.create(0u, false); + exp = Vec.init_elt[uint](0u, 0u); // FIXME: why can't I write vec[uint]()? - assert (bitv.eq_vec(act, exp)); + assert (BitV.eq_vec(act, exp)); } fn test_1_element() { auto act; - act = bitv.create(1u, false); - assert (bitv.eq_vec(act, vec(0u))); + act = BitV.create(1u, false); + assert (BitV.eq_vec(act, vec(0u))); - act = bitv.create(1u, true); - assert (bitv.eq_vec(act, vec(1u))); + act = BitV.create(1u, true); + assert (BitV.eq_vec(act, vec(1u))); } fn test_10_elements() { auto act; // all 0 - act = bitv.create(10u, false); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); + act = BitV.create(10u, false); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // all 1 - act = bitv.create(10u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); + act = BitV.create(10u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(10u, false); - bitv.set(act, 0u, true); - bitv.set(act, 1u, true); - bitv.set(act, 2u, true); - bitv.set(act, 3u, true); - bitv.set(act, 4u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u))); + act = BitV.create(10u, false); + BitV.set(act, 0u, true); + BitV.set(act, 1u, true); + BitV.set(act, 2u, true); + BitV.set(act, 3u, true); + BitV.set(act, 4u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(10u, false); - bitv.set(act, 5u, true); - bitv.set(act, 6u, true); - bitv.set(act, 7u, true); - bitv.set(act, 8u, true); - bitv.set(act, 9u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u))); + act = BitV.create(10u, false); + BitV.set(act, 5u, true); + BitV.set(act, 6u, true); + BitV.set(act, 7u, true); + BitV.set(act, 8u, true); + BitV.set(act, 9u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(10u, false); - bitv.set(act, 0u, true); - bitv.set(act, 3u, true); - bitv.set(act, 6u, true); - bitv.set(act, 9u, true); - assert (bitv.eq_vec(act, vec(1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u))); + act = BitV.create(10u, false); + BitV.set(act, 0u, true); + BitV.set(act, 3u, true); + BitV.set(act, 6u, true); + BitV.set(act, 9u, true); + assert (BitV.eq_vec(act, vec(1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u))); } fn test_31_elements() { auto act; // all 0 - act = bitv.create(31u, false); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(31u, false); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // all 1 - act = bitv.create(31u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(31u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(31u, false); - bitv.set(act, 0u, true); - bitv.set(act, 1u, true); - bitv.set(act, 2u, true); - bitv.set(act, 3u, true); - bitv.set(act, 4u, true); - bitv.set(act, 5u, true); - bitv.set(act, 6u, true); - bitv.set(act, 7u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(31u, false); + BitV.set(act, 0u, true); + BitV.set(act, 1u, true); + BitV.set(act, 2u, true); + BitV.set(act, 3u, true); + BitV.set(act, 4u, true); + BitV.set(act, 5u, true); + BitV.set(act, 6u, true); + BitV.set(act, 7u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(31u, false); - bitv.set(act, 16u, true); - bitv.set(act, 17u, true); - bitv.set(act, 18u, true); - bitv.set(act, 19u, true); - bitv.set(act, 20u, true); - bitv.set(act, 21u, true); - bitv.set(act, 22u, true); - bitv.set(act, 23u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(31u, false); + BitV.set(act, 16u, true); + BitV.set(act, 17u, true); + BitV.set(act, 18u, true); + BitV.set(act, 19u, true); + BitV.set(act, 20u, true); + BitV.set(act, 21u, true); + BitV.set(act, 22u, true); + BitV.set(act, 23u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(31u, false); - bitv.set(act, 24u, true); - bitv.set(act, 25u, true); - bitv.set(act, 26u, true); - bitv.set(act, 27u, true); - bitv.set(act, 28u, true); - bitv.set(act, 29u, true); - bitv.set(act, 30u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(31u, false); + BitV.set(act, 24u, true); + BitV.set(act, 25u, true); + BitV.set(act, 26u, true); + BitV.set(act, 27u, true); + BitV.set(act, 28u, true); + BitV.set(act, 29u, true); + BitV.set(act, 30u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(31u, false); - bitv.set(act, 3u, true); - bitv.set(act, 17u, true); - bitv.set(act, 30u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, + act = BitV.create(31u, false); + BitV.set(act, 3u, true); + BitV.set(act, 17u, true); + BitV.set(act, 30u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u))); @@ -136,71 +136,71 @@ fn test_32_elements() { auto act; // all 0 - act = bitv.create(32u, false); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(32u, false); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // all 1 - act = bitv.create(32u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(32u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(32u, false); - bitv.set(act, 0u, true); - bitv.set(act, 1u, true); - bitv.set(act, 2u, true); - bitv.set(act, 3u, true); - bitv.set(act, 4u, true); - bitv.set(act, 5u, true); - bitv.set(act, 6u, true); - bitv.set(act, 7u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(32u, false); + BitV.set(act, 0u, true); + BitV.set(act, 1u, true); + BitV.set(act, 2u, true); + BitV.set(act, 3u, true); + BitV.set(act, 4u, true); + BitV.set(act, 5u, true); + BitV.set(act, 6u, true); + BitV.set(act, 7u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(32u, false); - bitv.set(act, 16u, true); - bitv.set(act, 17u, true); - bitv.set(act, 18u, true); - bitv.set(act, 19u, true); - bitv.set(act, 20u, true); - bitv.set(act, 21u, true); - bitv.set(act, 22u, true); - bitv.set(act, 23u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(32u, false); + BitV.set(act, 16u, true); + BitV.set(act, 17u, true); + BitV.set(act, 18u, true); + BitV.set(act, 19u, true); + BitV.set(act, 20u, true); + BitV.set(act, 21u, true); + BitV.set(act, 22u, true); + BitV.set(act, 23u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(32u, false); - bitv.set(act, 24u, true); - bitv.set(act, 25u, true); - bitv.set(act, 26u, true); - bitv.set(act, 27u, true); - bitv.set(act, 28u, true); - bitv.set(act, 29u, true); - bitv.set(act, 30u, true); - bitv.set(act, 31u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(32u, false); + BitV.set(act, 24u, true); + BitV.set(act, 25u, true); + BitV.set(act, 26u, true); + BitV.set(act, 27u, true); + BitV.set(act, 28u, true); + BitV.set(act, 29u, true); + BitV.set(act, 30u, true); + BitV.set(act, 31u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(32u, false); - bitv.set(act, 3u, true); - bitv.set(act, 17u, true); - bitv.set(act, 30u, true); - bitv.set(act, 31u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, + act = BitV.create(32u, false); + BitV.set(act, 3u, true); + BitV.set(act, 17u, true); + BitV.set(act, 30u, true); + BitV.set(act, 31u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u))); @@ -210,77 +210,77 @@ fn test_33_elements() { auto act; // all 0 - act = bitv.create(33u, false); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(33u, false); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // all 1 - act = bitv.create(33u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(33u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u))); // mixed - act = bitv.create(33u, false); - bitv.set(act, 0u, true); - bitv.set(act, 1u, true); - bitv.set(act, 2u, true); - bitv.set(act, 3u, true); - bitv.set(act, 4u, true); - bitv.set(act, 5u, true); - bitv.set(act, 6u, true); - bitv.set(act, 7u, true); - assert (bitv.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + act = BitV.create(33u, false); + BitV.set(act, 0u, true); + BitV.set(act, 1u, true); + BitV.set(act, 2u, true); + BitV.set(act, 3u, true); + BitV.set(act, 4u, true); + BitV.set(act, 5u, true); + BitV.set(act, 6u, true); + BitV.set(act, 7u, true); + assert (BitV.eq_vec(act, vec(1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(33u, false); - bitv.set(act, 16u, true); - bitv.set(act, 17u, true); - bitv.set(act, 18u, true); - bitv.set(act, 19u, true); - bitv.set(act, 20u, true); - bitv.set(act, 21u, true); - bitv.set(act, 22u, true); - bitv.set(act, 23u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(33u, false); + BitV.set(act, 16u, true); + BitV.set(act, 17u, true); + BitV.set(act, 18u, true); + BitV.set(act, 19u, true); + BitV.set(act, 20u, true); + BitV.set(act, 21u, true); + BitV.set(act, 22u, true); + BitV.set(act, 23u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u))); // mixed - act = bitv.create(33u, false); - bitv.set(act, 24u, true); - bitv.set(act, 25u, true); - bitv.set(act, 26u, true); - bitv.set(act, 27u, true); - bitv.set(act, 28u, true); - bitv.set(act, 29u, true); - bitv.set(act, 30u, true); - bitv.set(act, 31u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + act = BitV.create(33u, false); + BitV.set(act, 24u, true); + BitV.set(act, 25u, true); + BitV.set(act, 26u, true); + BitV.set(act, 27u, true); + BitV.set(act, 28u, true); + BitV.set(act, 29u, true); + BitV.set(act, 30u, true); + BitV.set(act, 31u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u))); // mixed - act = bitv.create(33u, false); - bitv.set(act, 3u, true); - bitv.set(act, 17u, true); - bitv.set(act, 30u, true); - bitv.set(act, 31u, true); - bitv.set(act, 32u, true); - assert (bitv.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, + act = BitV.create(33u, false); + BitV.set(act, 3u, true); + BitV.set(act, 17u, true); + BitV.set(act, 30u, true); + BitV.set(act, 31u, true); + BitV.set(act, 32u, true); + assert (BitV.eq_vec(act, vec(0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, diff --git a/src/test/run-pass/lib-deque.rs b/src/test/run-pass/lib-deque.rs index 405ab72b..9de238dc 100644 --- a/src/test/run-pass/lib-deque.rs +++ b/src/test/run-pass/lib-deque.rs @@ -1,10 +1,10 @@ // -*- rust -*- use std; -import std.deque; +import std.Deque; fn test_simple() { - let deque.t[int] d = deque.create[int](); + let Deque.t[int] d = Deque.create[int](); assert (d.size() == 0u); d.add_front(17); d.add_front(42); @@ -57,7 +57,7 @@ fn test_simple() { } fn test_boxes(@int a, @int b, @int c, @int d) { - let deque.t[@int] deq = deque.create[@int](); + let Deque.t[@int] deq = Deque.create[@int](); assert (deq.size() == 0u); deq.add_front(a); deq.add_front(b); @@ -93,7 +93,7 @@ fn test_boxes(@int a, @int b, @int c, @int d) { type eqfn[T] = fn(&T a, &T b) -> bool; fn test_parameterized[T](eqfn[T] e, &T a, &T b, &T c, &T d) { - let deque.t[T] deq = deque.create[T](); + let Deque.t[T] deq = Deque.create[T](); assert (deq.size() == 0u); deq.add_front(a); deq.add_front(b); diff --git a/src/test/run-pass/lib-int.rs b/src/test/run-pass/lib-int.rs index e4e68351..a5a9a2a1 100644 --- a/src/test/run-pass/lib-int.rs +++ b/src/test/run-pass/lib-int.rs @@ -1,25 +1,25 @@ use std; -import std._int; -import std._str.eq; +import std.Int; +import std.Str.eq; fn test_to_str() { - assert (eq(_int.to_str(0, 10u), "0")); - assert (eq(_int.to_str(1, 10u), "1")); - assert (eq(_int.to_str(-1, 10u), "-1")); - assert (eq(_int.to_str(255, 16u), "ff")); - assert (eq(_int.to_str(100, 10u), "100")); + assert (eq(Int.to_str(0, 10u), "0")); + assert (eq(Int.to_str(1, 10u), "1")); + assert (eq(Int.to_str(-1, 10u), "-1")); + assert (eq(Int.to_str(255, 16u), "ff")); + assert (eq(Int.to_str(100, 10u), "100")); } fn test_pow() { - assert (_int.pow(0, 0u) == 1); - assert (_int.pow(0, 1u) == 0); - assert (_int.pow(0, 2u) == 0); - assert (_int.pow(-1, 0u) == -1); - assert (_int.pow(1, 0u) == 1); - assert (_int.pow(-3, 2u) == 9); - assert (_int.pow(-3, 3u) == -27); - assert (_int.pow(4, 9u) == 262144); + assert (Int.pow(0, 0u) == 1); + assert (Int.pow(0, 1u) == 0); + assert (Int.pow(0, 2u) == 0); + assert (Int.pow(-1, 0u) == -1); + assert (Int.pow(1, 0u) == 1); + assert (Int.pow(-3, 2u) == 9); + assert (Int.pow(-3, 3u) == -27); + assert (Int.pow(4, 9u) == 262144); } fn main() { diff --git a/src/test/run-pass/lib-io.rs b/src/test/run-pass/lib-io.rs index 5c97c2f0..e124cde3 100644 --- a/src/test/run-pass/lib-io.rs +++ b/src/test/run-pass/lib-io.rs @@ -5,8 +5,8 @@ // -*- rust -*- use std; -import std.io; -import std._str; +import std.IO; +import std.Str; fn test_simple(str tmpfilebase) { let str tmpfile = tmpfilebase + ".tmp"; @@ -15,14 +15,14 @@ fn test_simple(str tmpfilebase) { log frood; { - let io.writer out = io.file_writer(tmpfile, vec(io.create)); + let IO.writer out = IO.file_writer(tmpfile, vec(IO.create)); out.write_str(frood); } - let io.reader inp = io.file_reader(tmpfile); + let IO.reader inp = IO.file_reader(tmpfile); let str frood2 = inp.read_c_str(); log frood2; - assert (_str.eq(frood, frood2)); + assert (Str.eq(frood, frood2)); } fn main(vec[str] argv) { diff --git a/src/test/run-pass/lib-map.rs b/src/test/run-pass/lib-map.rs index abd2041e..1f956055 100644 --- a/src/test/run-pass/lib-map.rs +++ b/src/test/run-pass/lib-map.rs @@ -1,31 +1,31 @@ // -*- rust -*- use std; -import std.map; -import std._str; -import std._uint; -import std.util; +import std.Map; +import std.Str; +import std.UInt; +import std.Util; fn test_simple() { log "*** starting test_simple"; fn eq_uint(&uint x, &uint y) -> bool { ret x == y; } fn hash_uint(&uint u) -> uint { - // FIXME: can't use std.util.id since we'd be capturing a type param, + // FIXME: can't use std.Util.id since we'd be capturing a type param, // and presently we can't close items over type params. ret u; } - let map.hashfn[uint] hasher_uint = hash_uint; - let map.eqfn[uint] eqer_uint = eq_uint; + let Map.hashfn[uint] hasher_uint = hash_uint; + let Map.eqfn[uint] eqer_uint = eq_uint; - let map.hashfn[str] hasher_str = _str.hash; - let map.eqfn[str] eqer_str = _str.eq; + let Map.hashfn[str] hasher_str = Str.hash; + let Map.eqfn[str] eqer_str = Str.eq; log "uint -> uint"; - let map.hashmap[uint, uint] hm_uu = map.mk_hashmap[uint, uint](hasher_uint, + let Map.hashmap[uint, uint] hm_uu = Map.mk_hashmap[uint, uint](hasher_uint, eqer_uint); assert (hm_uu.insert(10u, 12u)); @@ -49,7 +49,7 @@ fn test_simple() { log "str -> uint"; - let map.hashmap[str, uint] hm_su = map.mk_hashmap[str, uint](hasher_str, + let Map.hashmap[str, uint] hm_su = Map.mk_hashmap[str, uint](hasher_str, eqer_str); assert (hm_su.insert("ten", 12u)); assert (hm_su.insert(eleven, 13u)); @@ -70,42 +70,42 @@ fn test_simple() { log "uint -> str"; - let map.hashmap[uint, str] hm_us = map.mk_hashmap[uint, str](hasher_uint, + let Map.hashmap[uint, str] hm_us = Map.mk_hashmap[uint, str](hasher_uint, eqer_uint); assert (hm_us.insert(10u, "twelve")); assert (hm_us.insert(11u, "thirteen")); assert (hm_us.insert(12u, "fourteen")); - assert (_str.eq(hm_us.get(11u), "thirteen")); - assert (_str.eq(hm_us.get(12u), "fourteen")); - assert (_str.eq(hm_us.get(10u), "twelve")); + assert (Str.eq(hm_us.get(11u), "thirteen")); + assert (Str.eq(hm_us.get(12u), "fourteen")); + assert (Str.eq(hm_us.get(10u), "twelve")); assert (!hm_us.insert(12u, "fourteen")); - assert (_str.eq(hm_us.get(12u), "fourteen")); + assert (Str.eq(hm_us.get(12u), "fourteen")); assert (!hm_us.insert(12u, "twelve")); - assert (_str.eq(hm_us.get(12u), "twelve")); + assert (Str.eq(hm_us.get(12u), "twelve")); log "str -> str"; - let map.hashmap[str, str] hm_ss = map.mk_hashmap[str, str](hasher_str, + let Map.hashmap[str, str] hm_ss = Map.mk_hashmap[str, str](hasher_str, eqer_str); assert (hm_ss.insert(ten, "twelve")); assert (hm_ss.insert(eleven, "thirteen")); assert (hm_ss.insert(twelve, "fourteen")); - assert (_str.eq(hm_ss.get("eleven"), "thirteen")); - assert (_str.eq(hm_ss.get("twelve"), "fourteen")); - assert (_str.eq(hm_ss.get("ten"), "twelve")); + assert (Str.eq(hm_ss.get("eleven"), "thirteen")); + assert (Str.eq(hm_ss.get("twelve"), "fourteen")); + assert (Str.eq(hm_ss.get("ten"), "twelve")); assert (!hm_ss.insert("twelve", "fourteen")); - assert (_str.eq(hm_ss.get("twelve"), "fourteen")); + assert (Str.eq(hm_ss.get("twelve"), "fourteen")); assert (!hm_ss.insert("twelve", "twelve")); - assert (_str.eq(hm_ss.get("twelve"), "twelve")); + assert (Str.eq(hm_ss.get("twelve"), "twelve")); log "*** finished test_simple"; } @@ -120,7 +120,7 @@ fn test_growth() { fn eq_uint(&uint x, &uint y) -> bool { ret x == y; } fn hash_uint(&uint u) -> uint { - // FIXME: can't use std.util.id since we'd be capturing a type param, + // FIXME: can't use std.Util.id since we'd be capturing a type param, // and presently we can't close items over type params. ret u; } @@ -128,16 +128,16 @@ fn test_growth() { log "uint -> uint"; - let map.hashfn[uint] hasher_uint = hash_uint; - let map.eqfn[uint] eqer_uint = eq_uint; - let map.hashmap[uint, uint] hm_uu = map.mk_hashmap[uint, uint](hasher_uint, + let Map.hashfn[uint] hasher_uint = hash_uint; + let Map.eqfn[uint] eqer_uint = eq_uint; + let Map.hashmap[uint, uint] hm_uu = Map.mk_hashmap[uint, uint](hasher_uint, eqer_uint); let uint i = 0u; while (i < num_to_insert) { assert (hm_uu.insert(i, i * i)); - log "inserting " + _uint.to_str(i, 10u) - + " -> " + _uint.to_str(i * i, 10u); + log "inserting " + UInt.to_str(i, 10u) + + " -> " + UInt.to_str(i * i, 10u); i += 1u; } @@ -145,8 +145,8 @@ fn test_growth() { i = 0u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm_uu.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm_uu.get(i), 10u); assert (hm_uu.get(i) == i * i); i += 1u; } @@ -160,8 +160,8 @@ fn test_growth() { i = 0u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm_uu.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm_uu.get(i), 10u); assert (hm_uu.get(i) == i * i); i += 1u; } @@ -169,16 +169,16 @@ fn test_growth() { log "str -> str"; - let map.hashfn[str] hasher_str = _str.hash; - let map.eqfn[str] eqer_str = _str.eq; - let map.hashmap[str, str] hm_ss = map.mk_hashmap[str, str](hasher_str, + let Map.hashfn[str] hasher_str = Str.hash; + let Map.eqfn[str] eqer_str = Str.eq; + let Map.hashmap[str, str] hm_ss = Map.mk_hashmap[str, str](hasher_str, eqer_str); i = 0u; while (i < num_to_insert) { - assert (hm_ss.insert(_uint.to_str(i, 2u), _uint.to_str(i * i, 2u))); - log "inserting \"" + _uint.to_str(i, 2u) - + "\" -> \"" + _uint.to_str(i * i, 2u) + "\""; + assert (hm_ss.insert(UInt.to_str(i, 2u), UInt.to_str(i * i, 2u))); + log "inserting \"" + UInt.to_str(i, 2u) + + "\" -> \"" + UInt.to_str(i * i, 2u) + "\""; i += 1u; } @@ -187,20 +187,20 @@ fn test_growth() { i = 0u; while (i < num_to_insert) { log "get(\"" - + _uint.to_str(i, 2u) + + UInt.to_str(i, 2u) + "\") = \"" - + hm_ss.get(_uint.to_str(i, 2u)) + "\""; + + hm_ss.get(UInt.to_str(i, 2u)) + "\""; - assert (_str.eq(hm_ss.get(_uint.to_str(i, 2u)), - _uint.to_str(i * i, 2u))); + assert (Str.eq(hm_ss.get(UInt.to_str(i, 2u)), + UInt.to_str(i * i, 2u))); i += 1u; } - assert (hm_ss.insert(_uint.to_str(num_to_insert, 2u), - _uint.to_str(17u, 2u))); + assert (hm_ss.insert(UInt.to_str(num_to_insert, 2u), + UInt.to_str(17u, 2u))); - assert (_str.eq(hm_ss.get(_uint.to_str(num_to_insert, 2u)), - _uint.to_str(17u, 2u))); + assert (Str.eq(hm_ss.get(UInt.to_str(num_to_insert, 2u)), + UInt.to_str(17u, 2u))); log "-----"; @@ -208,10 +208,10 @@ fn test_growth() { i = 0u; while (i < num_to_insert) { - log "get(\"" + _uint.to_str(i, 2u) + "\") = \"" - + hm_ss.get(_uint.to_str(i, 2u)) + "\""; - assert (_str.eq(hm_ss.get(_uint.to_str(i, 2u)), - _uint.to_str(i * i, 2u))); + log "get(\"" + UInt.to_str(i, 2u) + "\") = \"" + + hm_ss.get(UInt.to_str(i, 2u)) + "\""; + assert (Str.eq(hm_ss.get(UInt.to_str(i, 2u)), + UInt.to_str(i * i, 2u))); i += 1u; } @@ -234,15 +234,15 @@ fn test_removal() { assert (hash(2u) == hash(3u)); assert (hash(0u) != hash(2u)); - let map.hashfn[uint] hasher = hash; - let map.eqfn[uint] eqer = eq; - let map.hashmap[uint, uint] hm = map.mk_hashmap[uint, uint](hasher, eqer); + let Map.hashfn[uint] hasher = hash; + let Map.eqfn[uint] eqer = eq; + let Map.hashmap[uint, uint] hm = Map.mk_hashmap[uint, uint](hasher, eqer); let uint i = 0u; while (i < num_to_insert) { assert (hm.insert(i, i * i)); - log "inserting " + _uint.to_str(i, 10u) - + " -> " + _uint.to_str(i * i, 10u); + log "inserting " + UInt.to_str(i, 10u) + + " -> " + UInt.to_str(i * i, 10u); i += 1u; } @@ -279,8 +279,8 @@ fn test_removal() { i = 1u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm.get(i), 10u); assert (hm.get(i) == i * i); i += 2u; } @@ -294,8 +294,8 @@ fn test_removal() { i = 1u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm.get(i), 10u); assert (hm.get(i) == i * i); i += 2u; } @@ -305,8 +305,8 @@ fn test_removal() { i = 0u; while (i < num_to_insert) { assert (hm.insert(i, i * i)); - log "inserting " + _uint.to_str(i, 10u) - + " -> " + _uint.to_str(i * i, 10u); + log "inserting " + UInt.to_str(i, 10u) + + " -> " + UInt.to_str(i * i, 10u); i += 2u; } @@ -316,8 +316,8 @@ fn test_removal() { i = 0u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm.get(i), 10u); assert (hm.get(i) == i * i); i += 1u; } @@ -333,8 +333,8 @@ fn test_removal() { i = 0u; while (i < num_to_insert) { - log "get(" + _uint.to_str(i, 10u) + ") = " - + _uint.to_str(hm.get(i), 10u); + log "get(" + UInt.to_str(i, 10u) + ") = " + + UInt.to_str(hm.get(i), 10u); assert (hm.get(i) == i * i); i += 1u; } diff --git a/src/test/run-pass/lib-option.rs b/src/test/run-pass/lib-option.rs index 922072e5..417ab482 100644 --- a/src/test/run-pass/lib-option.rs +++ b/src/test/run-pass/lib-option.rs @@ -1,5 +1,5 @@ use std; fn main() { - auto x = std.option.some[int](10); + auto x = std.Option.some[int](10); } diff --git a/src/test/run-pass/lib-qsort.rs b/src/test/run-pass/lib-qsort.rs index f7f0f997..aed5009d 100644 --- a/src/test/run-pass/lib-qsort.rs +++ b/src/test/run-pass/lib-qsort.rs @@ -1,13 +1,13 @@ use std; fn check_sort(vec[mutable int] v1, vec[mutable int] v2) { - auto len = std._vec.len[int](v1); + auto len = std.Vec.len[int](v1); fn ltequal(&int a, &int b) -> bool { ret a <= b; } auto f = ltequal; - std.sort.quick_sort[int](f, v1); + std.Sort.quick_sort[int](f, v1); auto i = 0u; while (i < len) { log v2.(i); diff --git a/src/test/run-pass/lib-rand.rs b/src/test/run-pass/lib-rand.rs index 3ef94973..e423bcba 100644 --- a/src/test/run-pass/lib-rand.rs +++ b/src/test/run-pass/lib-rand.rs @@ -4,14 +4,14 @@ // -*- rust -*- use std; -import std.rand; +import std.Rand; fn main() { - let rand.rng r1 = rand.mk_rng(); + let Rand.rng r1 = Rand.mk_rng(); log r1.next(); log r1.next(); { - auto r2 = rand.mk_rng(); + auto r2 = Rand.mk_rng(); log r1.next(); log r2.next(); log r1.next(); diff --git a/src/test/run-pass/lib-sha1.rs b/src/test/run-pass/lib-sha1.rs index 7e8efb5e..2a7e8646 100644 --- a/src/test/run-pass/lib-sha1.rs +++ b/src/test/run-pass/lib-sha1.rs @@ -2,9 +2,9 @@ use std; -import std.sha1; -import std._vec; -import std._str; +import std.SHA1; +import std.Vec; +import std.Str; fn main() { @@ -69,8 +69,8 @@ fn main() { auto tests = fips_180_1_tests + wikipedia_tests; fn check_vec_eq(vec[u8] v0, vec[u8] v1) { - assert (_vec.len[u8](v0) == _vec.len[u8](v1)); - auto len = _vec.len[u8](v0); + assert (Vec.len[u8](v0) == Vec.len[u8](v1)); + auto len = Vec.len[u8](v0); auto i = 0u; while (i < len) { auto a = v0.(i); @@ -81,7 +81,7 @@ fn main() { } // Test that it works when accepting the message all at once - auto sh = sha1.mk_sha1(); + auto sh = SHA1.mk_sha1(); for (test t in tests) { sh.input_str(t.input); auto out = sh.result(); @@ -91,11 +91,11 @@ fn main() { // Test that it works when accepting the message in pieces for (test t in tests) { - auto len = _str.byte_len(t.input); + auto len = Str.byte_len(t.input); auto left = len; while (left > 0u) { auto take = (left + 1u) / 2u; - sh.input_str(_str.substr(t.input, len - left, take)); + sh.input_str(Str.substr(t.input, len - left, take)); left = left - take; } auto out = sh.result(); diff --git a/src/test/run-pass/lib-sort.rs b/src/test/run-pass/lib-sort.rs index a342b24e..145d0175 100644 --- a/src/test/run-pass/lib-sort.rs +++ b/src/test/run-pass/lib-sort.rs @@ -1,12 +1,12 @@ use std; fn check_sort(vec[int] v1, vec[int] v2) { - auto len = std._vec.len[int](v1); + auto len = std.Vec.len[int](v1); fn lteq(&int a, &int b) -> bool { ret a <= b; } auto f = lteq; - auto v3 = std.sort.merge_sort[int](f, v1); + auto v3 = std.Sort.merge_sort[int](f, v1); auto i = 0u; while (i < len) { log v3.(i); diff --git a/src/test/run-pass/lib-str-buf.rs b/src/test/run-pass/lib-str-buf.rs index 1f25373a..cd8ba9e9 100644 --- a/src/test/run-pass/lib-str-buf.rs +++ b/src/test/run-pass/lib-str-buf.rs @@ -4,14 +4,14 @@ // -*- rust -*- use std; -import std._str; +import std.Str; fn main() { auto s = "hello"; - auto sb = _str.rustrt.str_buf(s); - auto s_cstr = _str.rustrt.str_from_cstr(sb); - assert (_str.eq(s_cstr, s)); - auto s_buf = _str.rustrt.str_from_buf(sb, 5u); - assert (_str.eq(s_buf, s)); + auto sb = Str.rustrt.str_buf(s); + auto s_cstr = Str.rustrt.str_from_cstr(sb); + assert (Str.eq(s_cstr, s)); + auto s_buf = Str.rustrt.str_from_buf(sb, 5u); + assert (Str.eq(s_buf, s)); } diff --git a/src/test/run-pass/lib-str.rs b/src/test/run-pass/lib-str.rs index 76717711..58779f67 100644 --- a/src/test/run-pass/lib-str.rs +++ b/src/test/run-pass/lib-str.rs @@ -1,36 +1,36 @@ use std; -import std._str; +import std.Str; fn test_bytes_len() { - assert (_str.byte_len("") == 0u); - assert (_str.byte_len("hello world") == 11u); - assert (_str.byte_len("\x63") == 1u); - assert (_str.byte_len("\xa2") == 2u); - assert (_str.byte_len("\u03c0") == 2u); - assert (_str.byte_len("\u2620") == 3u); - assert (_str.byte_len("\U0001d11e") == 4u); + assert (Str.byte_len("") == 0u); + assert (Str.byte_len("hello world") == 11u); + assert (Str.byte_len("\x63") == 1u); + assert (Str.byte_len("\xa2") == 2u); + assert (Str.byte_len("\u03c0") == 2u); + assert (Str.byte_len("\u2620") == 3u); + assert (Str.byte_len("\U0001d11e") == 4u); } fn test_index_and_rindex() { - assert (_str.index("hello", 'e' as u8) == 1); - assert (_str.index("hello", 'o' as u8) == 4); - assert (_str.index("hello", 'z' as u8) == -1); - assert (_str.rindex("hello", 'l' as u8) == 3); - assert (_str.rindex("hello", 'h' as u8) == 0); - assert (_str.rindex("hello", 'z' as u8) == -1); + assert (Str.index("hello", 'e' as u8) == 1); + assert (Str.index("hello", 'o' as u8) == 4); + assert (Str.index("hello", 'z' as u8) == -1); + assert (Str.rindex("hello", 'l' as u8) == 3); + assert (Str.rindex("hello", 'h' as u8) == 0); + assert (Str.rindex("hello", 'z' as u8) == -1); } fn test_split() { fn t(&str s, char c, int i, &str k) { log "splitting: " + s; log i; - auto v = _str.split(s, c as u8); + auto v = Str.split(s, c as u8); log "split to: "; for (str z in v) { log z; } log "comparing: " + v.(i) + " vs. " + k; - assert (_str.eq(v.(i), k)); + assert (Str.eq(v.(i), k)); } t("abc.hello.there", '.', 0, "abc"); t("abc.hello.there", '.', 1, "hello"); @@ -43,7 +43,7 @@ fn test_split() { fn test_find() { fn t(&str haystack, &str needle, int i) { - let int j = _str.find(haystack,needle); + let int j = Str.find(haystack,needle); log "searched for " + needle; log j; assert (i == j); @@ -57,8 +57,8 @@ fn test_find() { fn test_substr() { fn t(&str a, &str b, int start) { - assert (_str.eq(_str.substr(a, start as uint, - _str.byte_len(b)), b)); + assert (Str.eq(Str.substr(a, start as uint, + Str.byte_len(b)), b)); } t("hello", "llo", 2); @@ -68,7 +68,7 @@ fn test_substr() { fn test_concat() { fn t(&vec[str] v, &str s) { - assert (_str.eq(_str.concat(v), s)); + assert (Str.eq(Str.concat(v), s)); } t(vec("you", "know", "I'm", "no", "good"), "youknowI'mnogood"); @@ -79,7 +79,7 @@ fn test_concat() { fn test_connect() { fn t(&vec[str] v, &str sep, &str s) { - assert (_str.eq(_str.connect(v, sep), s)); + assert (Str.eq(Str.connect(v, sep), s)); } t(vec("you", "know", "I'm", "no", "good"), " ", "you know I'm no good"); @@ -94,8 +94,8 @@ fn test_to_upper() { auto unicode = "\u65e5\u672c"; auto input = "abcDEF" + unicode + "xyz:.;"; auto expected = "ABCDEF" + unicode + "XYZ:.;"; - auto actual = _str.to_upper(input); - assert (_str.eq(expected, actual)); + auto actual = Str.to_upper(input); + assert (Str.eq(expected, actual)); } diff --git a/src/test/run-pass/lib-task.rs b/src/test/run-pass/lib-task.rs index 18499f4e..8e07962c 100644 --- a/src/test/run-pass/lib-task.rs +++ b/src/test/run-pass/lib-task.rs @@ -1,6 +1,6 @@ use std; -import std._task; +import std.Task; fn main() { - _task.sleep(1000000u); + Task.sleep(1000000u); }
\ No newline at end of file diff --git a/src/test/run-pass/lib-uint.rs b/src/test/run-pass/lib-uint.rs index 64d39619..4f787745 100644 --- a/src/test/run-pass/lib-uint.rs +++ b/src/test/run-pass/lib-uint.rs @@ -1,47 +1,47 @@ // -*- rust -*- use std; -import std._uint; +import std.UInt; fn main() { - assert (_uint.next_power_of_two(0u) == 0u); - assert (_uint.next_power_of_two(1u) == 1u); - assert (_uint.next_power_of_two(2u) == 2u); - assert (_uint.next_power_of_two(3u) == 4u); - assert (_uint.next_power_of_two(4u) == 4u); - assert (_uint.next_power_of_two(5u) == 8u); - assert (_uint.next_power_of_two(6u) == 8u); - assert (_uint.next_power_of_two(7u) == 8u); - assert (_uint.next_power_of_two(8u) == 8u); - assert (_uint.next_power_of_two(9u) == 16u); - assert (_uint.next_power_of_two(10u) == 16u); - assert (_uint.next_power_of_two(11u) == 16u); - assert (_uint.next_power_of_two(12u) == 16u); - assert (_uint.next_power_of_two(13u) == 16u); - assert (_uint.next_power_of_two(14u) == 16u); - assert (_uint.next_power_of_two(15u) == 16u); - assert (_uint.next_power_of_two(16u) == 16u); - assert (_uint.next_power_of_two(17u) == 32u); - assert (_uint.next_power_of_two(18u) == 32u); - assert (_uint.next_power_of_two(19u) == 32u); - assert (_uint.next_power_of_two(20u) == 32u); - assert (_uint.next_power_of_two(21u) == 32u); - assert (_uint.next_power_of_two(22u) == 32u); - assert (_uint.next_power_of_two(23u) == 32u); - assert (_uint.next_power_of_two(24u) == 32u); - assert (_uint.next_power_of_two(25u) == 32u); - assert (_uint.next_power_of_two(26u) == 32u); - assert (_uint.next_power_of_two(27u) == 32u); - assert (_uint.next_power_of_two(28u) == 32u); - assert (_uint.next_power_of_two(29u) == 32u); - assert (_uint.next_power_of_two(30u) == 32u); - assert (_uint.next_power_of_two(31u) == 32u); - assert (_uint.next_power_of_two(32u) == 32u); - assert (_uint.next_power_of_two(33u) == 64u); - assert (_uint.next_power_of_two(34u) == 64u); - assert (_uint.next_power_of_two(35u) == 64u); - assert (_uint.next_power_of_two(36u) == 64u); - assert (_uint.next_power_of_two(37u) == 64u); - assert (_uint.next_power_of_two(38u) == 64u); - assert (_uint.next_power_of_two(39u) == 64u); + assert (UInt.next_power_of_two(0u) == 0u); + assert (UInt.next_power_of_two(1u) == 1u); + assert (UInt.next_power_of_two(2u) == 2u); + assert (UInt.next_power_of_two(3u) == 4u); + assert (UInt.next_power_of_two(4u) == 4u); + assert (UInt.next_power_of_two(5u) == 8u); + assert (UInt.next_power_of_two(6u) == 8u); + assert (UInt.next_power_of_two(7u) == 8u); + assert (UInt.next_power_of_two(8u) == 8u); + assert (UInt.next_power_of_two(9u) == 16u); + assert (UInt.next_power_of_two(10u) == 16u); + assert (UInt.next_power_of_two(11u) == 16u); + assert (UInt.next_power_of_two(12u) == 16u); + assert (UInt.next_power_of_two(13u) == 16u); + assert (UInt.next_power_of_two(14u) == 16u); + assert (UInt.next_power_of_two(15u) == 16u); + assert (UInt.next_power_of_two(16u) == 16u); + assert (UInt.next_power_of_two(17u) == 32u); + assert (UInt.next_power_of_two(18u) == 32u); + assert (UInt.next_power_of_two(19u) == 32u); + assert (UInt.next_power_of_two(20u) == 32u); + assert (UInt.next_power_of_two(21u) == 32u); + assert (UInt.next_power_of_two(22u) == 32u); + assert (UInt.next_power_of_two(23u) == 32u); + assert (UInt.next_power_of_two(24u) == 32u); + assert (UInt.next_power_of_two(25u) == 32u); + assert (UInt.next_power_of_two(26u) == 32u); + assert (UInt.next_power_of_two(27u) == 32u); + assert (UInt.next_power_of_two(28u) == 32u); + assert (UInt.next_power_of_two(29u) == 32u); + assert (UInt.next_power_of_two(30u) == 32u); + assert (UInt.next_power_of_two(31u) == 32u); + assert (UInt.next_power_of_two(32u) == 32u); + assert (UInt.next_power_of_two(33u) == 64u); + assert (UInt.next_power_of_two(34u) == 64u); + assert (UInt.next_power_of_two(35u) == 64u); + assert (UInt.next_power_of_two(36u) == 64u); + assert (UInt.next_power_of_two(37u) == 64u); + assert (UInt.next_power_of_two(38u) == 64u); + assert (UInt.next_power_of_two(39u) == 64u); } diff --git a/src/test/run-pass/lib-vec-str-conversions.rs b/src/test/run-pass/lib-vec-str-conversions.rs index 3724d627..cd8b64a8 100644 --- a/src/test/run-pass/lib-vec-str-conversions.rs +++ b/src/test/run-pass/lib-vec-str-conversions.rs @@ -1,8 +1,8 @@ // -*- rust -*- use std; -import std._str; -import std._vec; +import std.Str; +import std.Vec; fn test_simple() { let str s1 = "All mimsy were the borogoves"; @@ -14,12 +14,12 @@ fn test_simple() { * working, but we should implement is_utf8 before that happens. */ - let vec[u8] v = _str.bytes(s1); - let str s2 = _str.from_bytes(v); + let vec[u8] v = Str.bytes(s1); + let str s2 = Str.from_bytes(v); let uint i = 0u; - let uint n1 = _str.byte_len(s1); - let uint n2 = _vec.len[u8](v); + let uint n1 = Str.byte_len(s1); + let uint n2 = Vec.len[u8](v); assert (n1 == n2); @@ -33,7 +33,7 @@ fn test_simple() { } log "refcnt is"; - log _str.refcount(s1); + log Str.refcount(s1); } fn main() { diff --git a/src/test/run-pass/lib-vec.rs b/src/test/run-pass/lib-vec.rs index 51341039..0905652a 100644 --- a/src/test/run-pass/lib-vec.rs +++ b/src/test/run-pass/lib-vec.rs @@ -1,8 +1,8 @@ use std; fn test_init_elt() { - let vec[uint] v = std._vec.init_elt[uint](5u, 3u); - assert (std._vec.len[uint](v) == 3u); + let vec[uint] v = std.Vec.init_elt[uint](5u, 3u); + assert (std.Vec.len[uint](v) == 3u); assert (v.(0) == 5u); assert (v.(1) == 5u); assert (v.(2) == 5u); @@ -13,8 +13,8 @@ fn id(uint x) -> uint { } fn test_init_fn() { let fn(uint)->uint op = id; - let vec[uint] v = std._vec.init_fn[uint](op, 5u); - assert (std._vec.len[uint](v) == 5u); + let vec[uint] v = std.Vec.init_fn[uint](op, 5u); + assert (std.Vec.len[uint](v) == 5u); assert (v.(0) == 0u); assert (v.(1) == 1u); assert (v.(2) == 2u); @@ -24,17 +24,17 @@ fn test_init_fn() { fn test_slice() { let vec[int] v = vec(1,2,3,4,5); - auto v2 = std._vec.slice[int](v, 2u, 4u); - assert (std._vec.len[int](v2) == 2u); + auto v2 = std.Vec.slice[int](v, 2u, 4u); + assert (std.Vec.len[int](v2) == 2u); assert (v2.(0) == 3); assert (v2.(1) == 4); } fn test_map() { fn square(&int x) -> int { ret x * x; } - let std.option.operator[int, int] op = square; + let std.Option.operator[int, int] op = square; let vec[int] v = vec(1, 2, 3, 4, 5); - let vec[int] s = std._vec.map[int, int](op, v); + let vec[int] s = std.Vec.map[int, int](op, v); let int i = 0; while (i < 5) { assert (v.(i) * v.(i) == s.(i)); @@ -47,7 +47,7 @@ fn test_map2() { auto f = times; auto v0 = vec(1, 2, 3, 4, 5); auto v1 = vec(5, 4, 3, 2, 1); - auto u = std._vec.map2[int,int,int](f, v0, v1); + auto u = std.Vec.map2[int,int,int](f, v0, v1); auto i = 0; while (i < 5) { diff --git a/src/test/run-pass/mlist-cycle.rs b/src/test/run-pass/mlist-cycle.rs index 7c41e4b5..b5eff76f 100644 --- a/src/test/run-pass/mlist-cycle.rs +++ b/src/test/run-pass/mlist-cycle.rs @@ -16,6 +16,6 @@ fn main() { let @cell first = @tup(mutable @nil()); let @cell second = @tup(mutable @link(first)); first._0 = @link(second); - std.sys.rustrt.gc(); + std.Sys.rustrt.gc(); let @cell third = @tup(mutable @nil()); } diff --git a/src/test/run-pass/mutable-alias-vec.rs b/src/test/run-pass/mutable-alias-vec.rs index 71d4dfe9..5919abdc 100644 --- a/src/test/run-pass/mutable-alias-vec.rs +++ b/src/test/run-pass/mutable-alias-vec.rs @@ -11,7 +11,7 @@ fn main() { grow(v); grow(v); grow(v); - auto len = std._vec.len[int](v); + auto len = std.Vec.len[int](v); log len; assert (len == (3 as uint)); } diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index e59c2dd5..cb244cc8 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -1,13 +1,13 @@ // a bug was causing this to complain about leaked memory on exit use std; -import std.option; -import std.option.some; -import std.option.none; +import std.Option; +import std.Option.some; +import std.Option.none; tag t { foo(int, uint); - bar(int, option.t[int]); + bar(int, Option.t[int]); } fn nested(t o) { diff --git a/src/test/run-pass/rt-circular-buffer.rs b/src/test/run-pass/rt-circular-buffer.rs index cd808ad7..b6c545b2 100644 --- a/src/test/run-pass/rt-circular-buffer.rs +++ b/src/test/run-pass/rt-circular-buffer.rs @@ -5,9 +5,9 @@ use std; -import std.option; -import std._uint; -import std._vec; +import std.Option; +import std.UInt; +import std.Vec; // A 12-byte unit to send over the channel type record = rec(u32 val1, u32 val2, u32 val3); @@ -33,7 +33,7 @@ fn test_grow() { let record val = rec(val1=0u32, val2=0u32, val3=0u32); - for each (uint i in _uint.range(0u, 100u)) { + for each (uint i in UInt.range(0u, 100u)) { mychan <| val; } } @@ -53,11 +53,11 @@ fn test_shrink2() { let record val = rec(val1=0u32, val2=0u32, val3=0u32); - for each (uint i in _uint.range(0u, 100u)) { + for each (uint i in UInt.range(0u, 100u)) { mychan <| val; } - for each (uint i in _uint.range(0u, 100u)) { + for each (uint i in UInt.range(0u, 100u)) { auto x <- myport; } } @@ -67,7 +67,7 @@ fn test_rotate() { let port[record] myport = port(); auto mychan = chan(myport); - for each (uint i in _uint.range(0u, 100u)) { + for each (uint i in UInt.range(0u, 100u)) { auto val = rec(val1=i as u32, val2=i as u32, val3=i as u32); @@ -86,15 +86,15 @@ fn test_rotate_grow() { let port[record] myport = port(); auto mychan = chan(myport); - for each (uint j in _uint.range(0u, 10u)) { - for each (uint i in _uint.range(0u, 10u)) { + for each (uint j in UInt.range(0u, 10u)) { + for each (uint i in UInt.range(0u, 10u)) { let record val = rec(val1=i as u32, val2=i as u32, val3=i as u32); mychan <| val; } - for each (uint i in _uint.range(0u, 10u)) { + for each (uint i in UInt.range(0u, 10u)) { auto x <- myport; assert (x.val1 == i as u32); assert (x.val2 == i as u32); diff --git a/src/test/run-pass/str-append.rs b/src/test/run-pass/str-append.rs index abfbe938..afca72a8 100644 --- a/src/test/run-pass/str-append.rs +++ b/src/test/run-pass/str-append.rs @@ -1,7 +1,7 @@ // -*- rust -*- use std; -import std._str; +import std.Str; fn test1() { let str s = "hello"; @@ -20,8 +20,8 @@ fn test2() { log a; log b; - assert (_str.eq(a, "abcABCabc")); - assert (_str.eq(b, "ABCabcABC")); + assert (Str.eq(a, "abcABCabc")); + assert (Str.eq(b, "ABCabcABC")); } fn main() { diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index bb0c851f..08a8c499 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -3,12 +3,12 @@ // xfail-stage1 // xfail-stage2 use std; -import std._str; +import std.Str; fn test(str actual, str expected) { log actual; log expected; - assert (_str.eq(actual, expected)); + assert (Str.eq(actual, expected)); } fn main() { diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index 2f8ef985..d4a135c2 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -3,7 +3,7 @@ // xfail-stage1 // xfail-stage2 use std; -import std._task; +import std.Task; fn main() -> () { test00(); @@ -18,7 +18,7 @@ fn test00() { let task t = spawn thread "child" start(i); // Sleep long enough for the task to finish. - _task.sleep(10000u); + Task.sleep(10000u); // Try joining tasks that have already finished. join t; diff --git a/src/test/run-pass/task-comm-13-thread.rs b/src/test/run-pass/task-comm-13-thread.rs index e5e42010..fedc516b 100644 --- a/src/test/run-pass/task-comm-13-thread.rs +++ b/src/test/run-pass/task-comm-13-thread.rs @@ -2,7 +2,7 @@ // xfail-stage1 // xfail-stage2 use std; -import std._task; +import std.Task; fn start(chan[int] c, int start, int number_of_messages) { let int i = 0; diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index bcae26e5..1bf5d1f5 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -2,7 +2,7 @@ // xfail-stage1 // xfail-stage2 use std; -import std._task; +import std.Task; fn start(chan[int] c, int start, int number_of_messages) { let int i = 0; diff --git a/src/test/run-pass/type-sizes.rs b/src/test/run-pass/type-sizes.rs index e416e9b5..d39a2064 100644 --- a/src/test/run-pass/type-sizes.rs +++ b/src/test/run-pass/type-sizes.rs @@ -2,7 +2,7 @@ // xfail-stage1 // xfail-stage2 -import size_of = std.sys.rustrt.size_of; +import size_of = std.Sys.rustrt.size_of; use std; diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index 37cfe074..3d1a6947 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -7,8 +7,8 @@ use zed(name = "std"); use bar(name = "std", ver = "0.0.1"); // FIXME: commented out since resolve doesn't know how to handle crates yet. -// import std._str; -// import x = std._str; +// import std.Str; +// import x = std.Str; mod baz { use std; @@ -16,8 +16,8 @@ mod baz { use zed(name = "std"); use bar(name = "std", ver = "0.0.1"); - // import std._str; - // import x = std._str; + // import std.Str; + // import x = std.Str; } fn main() { diff --git a/src/test/run-pass/user.rs b/src/test/run-pass/user.rs index 679d3e48..877c416b 100644 --- a/src/test/run-pass/user.rs +++ b/src/test/run-pass/user.rs @@ -8,10 +8,10 @@ use std (name = "std", uuid = _, ver = _); fn main() { - auto s = std._str.alloc(10 as uint); + auto s = std.Str.alloc(10 as uint); s += "hello "; log s; s += "there"; log s; - auto z = std._vec.alloc[int](10 as uint); + auto z = std.Vec.alloc[int](10 as uint); } diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index e2df05dc..95cbc64e 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -2,34 +2,34 @@ // xfail-stage1 // xfail-stage2 use std; -import std._str; -import std._vec; -import std.io; +import std.Str; +import std.Vec; +import std.IO; fn main() { // Chars of 1, 2, 3, and 4 bytes let vec[char] chs = vec('e', 'é', '€', 0x10000 as char); - let str s = _str.from_chars(chs); + let str s = Str.from_chars(chs); - assert (_str.byte_len(s) == 10u); - assert (_str.char_len(s) == 4u); - assert (_vec.len[char](_str.to_chars(s)) == 4u); - assert (_str.eq(_str.from_chars(_str.to_chars(s)), s)); - assert (_str.char_at(s, 0u) == 'e'); - assert (_str.char_at(s, 1u) == 'é'); + assert (Str.byte_len(s) == 10u); + assert (Str.char_len(s) == 4u); + assert (Vec.len[char](Str.to_chars(s)) == 4u); + assert (Str.eq(Str.from_chars(Str.to_chars(s)), s)); + assert (Str.char_at(s, 0u) == 'e'); + assert (Str.char_at(s, 1u) == 'é'); - assert (_str.is_utf8(_str.bytes(s))); - assert (!_str.is_utf8(vec(0x80_u8))); - assert (!_str.is_utf8(vec(0xc0_u8))); - assert (!_str.is_utf8(vec(0xc0_u8, 0x10_u8))); + assert (Str.is_utf8(Str.bytes(s))); + assert (!Str.is_utf8(vec(0x80_u8))); + assert (!Str.is_utf8(vec(0xc0_u8))); + assert (!Str.is_utf8(vec(0xc0_u8, 0x10_u8))); auto stack = "a×c€"; - assert (_str.pop_char(stack) == '€'); - assert (_str.pop_char(stack) == 'c'); - _str.push_char(stack, 'u'); - assert (_str.eq(stack, "a×u")); - assert (_str.shift_char(stack) == 'a'); - assert (_str.shift_char(stack) == '×'); - _str.unshift_char(stack, 'ß'); - assert (_str.eq(stack, "ßu")); + assert (Str.pop_char(stack) == '€'); + assert (Str.pop_char(stack) == 'c'); + Str.push_char(stack, 'u'); + assert (Str.eq(stack, "a×u")); + assert (Str.shift_char(stack) == 'a'); + assert (Str.shift_char(stack) == '×'); + Str.unshift_char(stack, 'ß'); + assert (Str.eq(stack, "ßu")); } diff --git a/src/test/run-pass/vec-alloc-append.rs b/src/test/run-pass/vec-alloc-append.rs index 616823ae..4327e789 100644 --- a/src/test/run-pass/vec-alloc-append.rs +++ b/src/test/run-pass/vec-alloc-append.rs @@ -6,7 +6,7 @@ use std; fn slice[T](vec[T] e) { - let vec[T] result = std._vec.alloc[T](1 as uint); + let vec[T] result = std.Vec.alloc[T](1 as uint); log "alloced"; result += e; log "appended"; diff --git a/src/test/run-pass/vec-append.rs b/src/test/run-pass/vec-append.rs index e63b1d09..cd87ec23 100644 --- a/src/test/run-pass/vec-append.rs +++ b/src/test/run-pass/vec-append.rs @@ -4,11 +4,11 @@ // -*- rust -*- use std; -import std._str; -import std._vec; +import std.Str; +import std.Vec; -// FIXME: import std.dbg.const_refcount. Currently +// FIXME: import std.Dbg.const_refcount. Currently // cross-crate const references don't work. const uint const_refcount = 0x7bad_face_u; @@ -53,30 +53,30 @@ fn slow_growth2_helper(str s) { // ref up: s let vec[str] v = vec(mumble); // ref up: v, mumble let acc a = acc(v); // ref up: a, v - log _vec.refcount[str](v); - assert (_vec.refcount[str](v) == 2u); + log Vec.refcount[str](v); + assert (Vec.refcount[str](v) == 2u); a.add(s); // ref up: mumble, s. ref down: v - log _vec.refcount[str](v); - log _str.refcount(s); - log _str.refcount(mumble); + log Vec.refcount[str](v); + log Str.refcount(s); + log Str.refcount(mumble); - assert (_vec.refcount[str](v) == 1u); - assert (_str.refcount(s) == const_refcount); - assert (_str.refcount(mumble) == const_refcount); + assert (Vec.refcount[str](v) == 1u); + assert (Str.refcount(s) == const_refcount); + assert (Str.refcount(mumble) == const_refcount); log v.(0); - log _vec.len[str](v); - assert (_str.eq(v.(0), mumble)); - assert (_vec.len[str](v) == 1u); + log Vec.len[str](v); + assert (Str.eq(v.(0), mumble)); + assert (Vec.len[str](v) == 1u); } // ref down: a, mumble, s, v - log _str.refcount(s); - log _str.refcount(mumble); + log Str.refcount(s); + log Str.refcount(mumble); - assert (_str.refcount(s) == const_refcount); - assert (_str.refcount(mumble) == const_refcount); + assert (Str.refcount(s) == const_refcount); + assert (Str.refcount(mumble) == const_refcount); log mumble; log ss; @@ -85,8 +85,8 @@ fn slow_growth2_helper(str s) { // ref up: s fn slow_growth2() { let str s = "hi"; // ref up: s slow_growth2_helper(s); - log _str.refcount(s); - assert (_str.refcount(s) == const_refcount); + log Str.refcount(s); + assert (Str.refcount(s) == const_refcount); } fn main() { diff --git a/src/test/run-pass/vec-ref-count.rs b/src/test/run-pass/vec-ref-count.rs index 45f28f9b..4534a861 100644 --- a/src/test/run-pass/vec-ref-count.rs +++ b/src/test/run-pass/vec-ref-count.rs @@ -1,12 +1,12 @@ use std; -import std._vec; +import std.Vec; fn main() { auto v = vec(1, 2, 3); - log_err _vec.refcount[int](v); - log_err _vec.refcount[int](v); - log_err _vec.refcount[int](v); - assert (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u); - assert (_vec.refcount[int](v) == 1u || _vec.refcount[int](v) == 2u); + log_err Vec.refcount[int](v); + log_err Vec.refcount[int](v); + log_err Vec.refcount[int](v); + assert (Vec.refcount[int](v) == 1u || Vec.refcount[int](v) == 2u); + assert (Vec.refcount[int](v) == 1u || Vec.refcount[int](v) == 2u); } |