Skip to content

Commit

Permalink
Change 'print(fmt!(...))' to printf!/printfln! in src/test/
Browse files Browse the repository at this point in the history
  • Loading branch information
poiru authored and thestinger committed Jul 24, 2013
1 parent d047cf1 commit 206ae57
Show file tree
Hide file tree
Showing 63 changed files with 99 additions and 103 deletions.
4 changes: 2 additions & 2 deletions src/test/bench/core-map.rs
Expand Up @@ -24,7 +24,7 @@ fn timed(label: &str, f: &fn()) {
let start = time::precise_time_s();
f();
let end = time::precise_time_s();
io::println(fmt!(" %s: %f", label, end - start));
printfln!(" %s: %f", label, end - start);
}

fn ascending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
Expand Down Expand Up @@ -116,7 +116,7 @@ fn main() {
}
}

io::println(fmt!("%? keys", n_keys));
printfln!("%? keys", n_keys);

io::println("\nTreeMap:");

Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/core-std.rs
Expand Up @@ -58,7 +58,7 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
test();
let stop = precise_time_s();

io::println(fmt!("%s:\t\t%f ms", name, (stop - start) * 1000f));
printfln!("%s:\t\t%f ms", name, (stop - start) * 1000f);
}

fn shift_push() {
Expand Down
7 changes: 3 additions & 4 deletions src/test/bench/msgsend-ring-mutex-arcs.rs
Expand Up @@ -119,8 +119,7 @@ fn main() {
let elapsed = (stop - start);
let rate = (num_msgs as float) / elapsed;

io::println(fmt!("Sent %? messages in %? seconds",
num_msgs, elapsed));
io::println(fmt!(" %? messages / second", rate));
io::println(fmt!(" %? μs / message", 1000000. / rate));
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
printfln!(" %? messages / second", rate);
printfln!(" %? μs / message", 1000000. / rate);
}
7 changes: 3 additions & 4 deletions src/test/bench/msgsend-ring-pipes.rs
Expand Up @@ -105,8 +105,7 @@ fn main() {
let elapsed = (stop - start);
let rate = (num_msgs as float) / elapsed;

io::println(fmt!("Sent %? messages in %? seconds",
num_msgs, elapsed));
io::println(fmt!(" %? messages / second", rate));
io::println(fmt!(" %? μs / message", 1000000. / rate));
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
printfln!(" %? messages / second", rate);
printfln!(" %? μs / message", 1000000. / rate);
}
7 changes: 3 additions & 4 deletions src/test/bench/msgsend-ring-rw-arcs.rs
Expand Up @@ -115,8 +115,7 @@ fn main() {
let elapsed = (stop - start);
let rate = (num_msgs as float) / elapsed;

io::println(fmt!("Sent %? messages in %? seconds",
num_msgs, elapsed));
io::println(fmt!(" %? messages / second", rate));
io::println(fmt!(" %? μs / message", 1000000. / rate));
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
printfln!(" %? messages / second", rate);
printfln!(" %? μs / message", 1000000. / rate);
}
18 changes: 9 additions & 9 deletions src/test/bench/pingpong.rs
Expand Up @@ -198,13 +198,13 @@ fn main() {
let bounded = do timeit { bounded(count) };
let unbounded = do timeit { unbounded(count) };

io::println(fmt!("count: %?\n", count));
io::println(fmt!("bounded: %? s\t(%? μs/message)",
bounded, bounded * 1000000. / (count as float)));
io::println(fmt!("unbounded: %? s\t(%? μs/message)",
unbounded, unbounded * 1000000. / (count as float)));

io::println(fmt!("\n\
bounded is %?%% faster",
(unbounded - bounded) / bounded * 100.));
printfln!("count: %?\n", count);
printfln!("bounded: %? s\t(%? μs/message)",
bounded, bounded * 1000000. / (count as float));
printfln!("unbounded: %? s\t(%? μs/message)",
unbounded, unbounded * 1000000. / (count as float));

printfln!("\n\
bounded is %?%% faster",
(unbounded - bounded) / bounded * 100.);
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-ackermann.rs
Expand Up @@ -36,5 +36,5 @@ fn main() {
args
};
let n = int::from_str(args[1]).get();
io::println(fmt!("Ack(3,%d): %d\n", n, ack(3, n)));
printfln!("Ack(3,%d): %d\n", n, ack(3, n));
}
17 changes: 8 additions & 9 deletions src/test/bench/shootout-binarytrees.rs
Expand Up @@ -61,9 +61,9 @@ fn main() {
let stretch_depth = max_depth + 1;
let stretch_tree = bottom_up_tree(&stretch_arena, 0, stretch_depth);

println(fmt!("stretch tree of depth %d\t check: %d",
stretch_depth,
item_check(stretch_tree)));
printfln!("stretch tree of depth %d\t check: %d",
stretch_depth,
item_check(stretch_tree));

let long_lived_arena = arena::Arena();
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
Expand All @@ -79,12 +79,11 @@ fn main() {
chk += item_check(temp_tree);
i += 1;
}
println(fmt!("%d\t trees of depth %d\t check: %d",
iterations * 2, depth,
chk));
printfln!("%d\t trees of depth %d\t check: %d",
iterations * 2, depth, chk));
depth += 2;
}
println(fmt!("long lived tree of depth %d\t check: %d",
max_depth,
item_check(long_lived_tree)));
printfln!("long lived tree of depth %d\t check: %d",
max_depth,
item_check(long_lived_tree));
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-fannkuch-redux.rs
Expand Up @@ -93,5 +93,5 @@ fn fannkuch_redux(n: i32) -> i32 {
#[fixed_stack_segment]
fn main() {
let n: i32 = FromStr::from_str(os::args()[1]).get();
println(fmt!("Pfannkuchen(%d) = %d", n as int, fannkuch_redux(n) as int));
printfln!("Pfannkuchen(%d) = %d", n as int, fannkuch_redux(n) as int);
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-fibo.rs
Expand Up @@ -32,5 +32,5 @@ fn main() {
args
};
let n = int::from_str(args[1]).get();
io::println(fmt!("%d\n", fib(n)));
printfln!("%d\n", fib(n));
}
8 changes: 4 additions & 4 deletions src/test/bench/shootout-k-nucleotide.rs
Expand Up @@ -82,7 +82,7 @@ struct PrintCallback(&'static str);

impl TableCallback for PrintCallback {
fn f(&self, entry: &mut Entry) {
println(fmt!("%d\t%s", entry.count as int, **self));
printfln!("%d\t%s", entry.count as int, **self);
}
}

Expand Down Expand Up @@ -279,9 +279,9 @@ fn print_frequencies(frequencies: &Table, frame: i32) {
}

for vector.each |&(key, count)| {
println(fmt!("%s %.3f",
key.unpack(frame),
(count as float * 100.0) / (total_count as float)));
printfln!("%s %.3f",
key.unpack(frame),
(count as float * 100.0) / (total_count as float));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-mandelbrot.rs
Expand Up @@ -15,7 +15,7 @@ fn main() {
let mut byte_acc: i8 = 0;
let mut bit_num: i32 = 0;

println(fmt!("P4\n%d %d", w as int, h as int));
printfln!("P4\n%d %d", w as int, h as int);

let mode = "w";
let stdout = fdopen(STDOUT_FILENO as c_int, transmute(&mode[0]));
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-nbody.rs
Expand Up @@ -142,9 +142,9 @@ fn main() {
let mut bodies = BODIES;

offset_momentum(&mut bodies);
println(fmt!("%.9f", energy(&bodies) as float));
printfln!("%.9f", energy(&bodies) as float);

advance(&mut bodies, 0.01, n);

println(fmt!("%.9f", energy(&bodies) as float));
printfln!("%.9f", energy(&bodies) as float);
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-spectralnorm.rs
Expand Up @@ -61,5 +61,5 @@ fn main() {
mult_AtAv(v, u, tmp);
}

println(fmt!("%.9f", (dot(u,v) / dot(v,v)).sqrt() as float));
printfln!("%.9f", (dot(u,v) / dot(v,v)).sqrt() as float);
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-threadring.rs
Expand Up @@ -40,7 +40,7 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
while (true) {
match p.recv() {
1 => {
println(fmt!("%d\n", id));
printfln!("%d\n", id);
return;
}
token => {
Expand Down
Expand Up @@ -18,7 +18,7 @@ struct Foo {

impl Foo {
pub fn printme(&mut self) {
io::println(fmt!("%d", self.x));
printfln!("%d", self.x);
}
}

Expand Down
Expand Up @@ -9,5 +9,5 @@ fn a() -> &int {

fn main() {
let fifth = a();
println(fmt!("%d", *fifth));
printfln!("%d", *fifth);
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-3820.rs
Expand Up @@ -22,5 +22,5 @@ fn main() {
let u = Thing {x: 2};
let _v = u.mul(&3); // This is ok
let w = u * 3; //~ ERROR binary operation * cannot be applied to type `Thing`
println(fmt!("%i", w.x));
printfln!("%i", w.x);
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-4335.rs
Expand Up @@ -14,5 +14,5 @@ fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cann

fn main() {
let v = &5;
println(fmt!("%d", f(v)()));
printfln!("%d", f(v)());
}
Expand Up @@ -28,7 +28,7 @@ fn innocent_looking_victim() {
match x {
Some(ref msg) => {
(f.c)(f, true);
println(fmt!("%?", msg));
printfln!(msg);
},
None => fail!("oops"),
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/tuple-struct-nonexhaustive.rs
Expand Up @@ -13,7 +13,7 @@ struct Foo(int, int);
fn main() {
let x = Foo(1, 2);
match x { //~ ERROR non-exhaustive
Foo(1, b) => println(fmt!("%d", b)),
Foo(2, b) => println(fmt!("%d", b))
Foo(1, b) => printfln!("%d", b),
Foo(2, b) => printfln!("%d", b)
}
}
Expand Up @@ -33,5 +33,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(z.my_mut_slice(), z2.my_slice());
print(fmt!("%d\n", z[0]));
printfln!("%d", z[0]);
}
2 changes: 1 addition & 1 deletion src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
Expand Up @@ -12,5 +12,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(z, z2);
print(fmt!("%d\n", z[0]));
printfln!("%d", z[0]);
}
2 changes: 1 addition & 1 deletion src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
Expand Up @@ -13,5 +13,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&mut z[0], &z2[0]);
print(fmt!("%d\n", z[0]));
printfln!("%d", z[0]);
}
2 changes: 1 addition & 1 deletion src/test/run-fail/borrowck-wg-two-array-indices.rs
Expand Up @@ -13,5 +13,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&mut z[0], &mut z2[0]);
print(fmt!("%d\n", z[0]));
printfln!("%d", z[0]);
}
2 changes: 1 addition & 1 deletion src/test/run-pass/auto-ref.rs
Expand Up @@ -18,7 +18,7 @@ trait Stuff {

impl Stuff for Foo {
fn printme(&self) {
println(fmt!("%d", self.x));
printfln!("%d", self.x);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/borrowck-wg-two-imm-borrows.rs
Expand Up @@ -10,5 +10,5 @@ pub fn main()
let z = @mut [1,2,3];
let z2 = z;
add(&z[0], &z2[0]);
print(fmt!("%d\n", z[0]));
printfln!("%d", z[0]);
}
2 changes: 1 addition & 1 deletion src/test/run-pass/cci_impl_exe.rs
Expand Up @@ -19,7 +19,7 @@ pub fn main() {
//info!("%?", bt0);

do 3u.to(10u) |i| {
print(fmt!("%u\n", i));
printfln!("%u", i);

//let bt1 = sys::frame_address();
//info!("%?", bt1);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/cci_iter_exe.rs
Expand Up @@ -17,7 +17,7 @@ pub fn main() {
//let bt0 = sys::rusti::frame_address(1u32);
//info!("%?", bt0);
do cci_iter_lib::iter(~[1, 2, 3]) |i| {
print(fmt!("%d", *i));
printf!("%d", *i);
//assert!(bt0 == sys::rusti::frame_address(2u32));
}
}
2 changes: 1 addition & 1 deletion src/test/run-pass/cci_no_inline_exe.rs
Expand Up @@ -23,7 +23,7 @@ pub fn main() {
//let bt0 = sys::frame_address();
//info!("%?", bt0);
do iter(~[1u, 2u, 3u]) |i| {
print(fmt!("%u\n", i));
printfln!("%u", i);

//let bt1 = sys::frame_address();
//info!("%?", bt1);
Expand Down
6 changes: 3 additions & 3 deletions src/test/run-pass/const-fields-and-indexing.rs
Expand Up @@ -27,9 +27,9 @@ static k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}};
static m : int = k.c.e;

pub fn main() {
io::println(fmt!("%?", p));
io::println(fmt!("%?", q));
io::println(fmt!("%?", t));
printfln!(p);
printfln!(q);
printfln!(t);
assert_eq!(p, 3);
assert_eq!(q, 3);
assert_eq!(t, 20);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-rec-and-tup.rs
Expand Up @@ -21,5 +21,5 @@ static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0,
pub fn main() {
let (p, _) = y.x;
assert_eq!(p, - 1085102592571150096);
println(fmt!("0x%x", p as uint));
printfln!("0x%x", p as uint);
}
4 changes: 2 additions & 2 deletions src/test/run-pass/const-region-ptrs.rs
Expand Up @@ -17,8 +17,8 @@ static x: &'static int = &10;
static y: &'static Pair<'static> = &Pair {a: 15, b: x};

pub fn main() {
io::println(fmt!("x = %?", *x));
io::println(fmt!("y = {a: %?, b: %?}", y.a, *(y.b)));
printfln!("x = %?", *x);
printfln!("y = {a: %?, b: %?}", y.a, *(y.b));
assert_eq!(*x, 10);
assert_eq!(*(y.b), 10);
}
4 changes: 2 additions & 2 deletions src/test/run-pass/const-struct.rs
Expand Up @@ -30,6 +30,6 @@ pub fn main() {
assert_eq!(x.b, 2);
assert_eq!(x, y);
assert_eq!(z.b, 22);
io::println(fmt!("0x%x", x.b as uint));
io::println(fmt!("0x%x", z.c as uint));
printfln!("0x%x", x.b as uint);
printfln!("0x%x", z.c as uint);
}
4 changes: 2 additions & 2 deletions src/test/run-pass/const-vecs-and-slices.rs
Expand Up @@ -14,8 +14,8 @@ static x : [int, ..4] = [1,2,3,4];
static y : &'static [int] = &[1,2,3,4];

pub fn main() {
io::println(fmt!("%?", x[1]));
io::println(fmt!("%?", y[1]));
printfln!(x[1]);
printfln!(y[1]);
assert_eq!(x[1], 2);
assert_eq!(x[3], 4);
assert_eq!(x[3], y[3]);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/functional-struct-update.rs
Expand Up @@ -16,5 +16,5 @@ struct Foo {
pub fn main() {
let a = Foo { x: 1, y: 2 };
let c = Foo { x: 4, .. a};
println(fmt!("%?", c));
printfln!(c);
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-2185.rs
Expand Up @@ -80,5 +80,5 @@ pub fn main() {
a);
let sum = foldl(filt, 0u, |accum, &&n: uint| accum + n );

io::println(fmt!("%u", sum));
printfln!("%u", sum);
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-2989.rs
Expand Up @@ -42,7 +42,7 @@ pub fn main() {
let bools2 = to_bools(Storage{storage: ~[0b01100100]});

for uint::range(0, 8) |i| {
io::println(fmt!("%u => %u vs %u", i, bools[i] as uint, bools2[i] as uint));
printfln!("%u => %u vs %u", i, bools[i] as uint, bools2[i] as uint);
}

assert_eq!(bools, bools2);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-3211.rs
Expand Up @@ -4,5 +4,5 @@ pub fn main() {
x += 1;
}
assert_eq!(x, 4096);
println(fmt!("x = %u", x));
printfln!("x = %u", x);
}

0 comments on commit 206ae57

Please sign in to comment.