Skip to content

Commit e686104

Browse files
author
Robin Kruppe
committed
---
yaml --- r: 274623 b: refs/heads/stable c: a8dc1f9 h: refs/heads/master i: 274621: c7f1f44 274619: 77a1257 274615: 7e14da0 274607: 42a999a 274591: 2a64474 274559: 77e3eb3
1 parent 445e63d commit e686104

File tree

12 files changed

+44
-17
lines changed

12 files changed

+44
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 25c9ac32804ff3d513020f02a8bbe5bc1afd6504
32+
refs/heads/stable: a8dc1f974be05b80b2edf17b62eee47e38edf2de
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/etc/test-float-parse/_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::mem::transmute;
1616
#[allow(dead_code)]
1717
pub const SEED: [u32; 3] = [0x243f_6a88, 0x85a3_08d3, 0x1319_8a2e];
1818

19-
pub fn validate(text: String) {
19+
pub fn validate(text: &str) {
2020
let mut out = io::stdout();
2121
let x: f64 = text.parse().unwrap();
2222
let f64_bytes: u64 = unsafe { transmute(x) };

branches/stable/src/etc/test-float-parse/few-ones.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
for a in &pow {
2121
for b in &pow {
2222
for c in &pow {
23-
validate((a | b | c).to_string());
23+
validate(&(a | b | c).to_string());
2424
}
2525
}
2626
}

branches/stable/src/etc/test-float-parse/huge-pow10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use _common::validate;
1515
fn main() {
1616
for e in 300..310 {
1717
for i in 0..100000 {
18-
validate(format!("{}e{}", i, e));
18+
validate(&format!("{}e{}", i, e));
1919
}
2020
}
2121
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
mod _common;
12+
13+
use std::char;
14+
use _common::validate;
15+
16+
fn main() {
17+
for n in 0..10 {
18+
let digit = char::from_digit(n, 10).unwrap();
19+
let mut s = "0.".to_string();
20+
for _ in 0..400 {
21+
s.push(digit);
22+
if s.parse::<f64>().is_ok() {
23+
validate(&s);
24+
}
25+
}
26+
}
27+
}

branches/stable/src/etc/test-float-parse/many-digits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ fn main() {
2323
let mut rnd = IsaacRng::from_seed(&SEED);
2424
let mut range = Range::new(0, 10);
2525
for _ in 0..5_000_000u64 {
26-
let num_digits = rnd.gen_range(100, 300);
26+
let num_digits = rnd.gen_range(100, 400);
2727
let digits = gen_digits(num_digits, &mut range, &mut rnd);
28-
validate(digits);
28+
validate(&digits);
2929
}
3030
}
3131

branches/stable/src/etc/test-float-parse/rand-f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() {
2525
let bits = rnd.next_u64();
2626
let x: f64 = unsafe { transmute(bits) };
2727
if x.is_finite() {
28-
validate(format!("{:e}", x));
28+
validate(&format!("{:e}", x));
2929
i += 1;
3030
}
3131
}

branches/stable/src/etc/test-float-parse/short-decimals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ fn main() {
2222
if i % 10 == 0 {
2323
continue;
2424
}
25-
validate(format!("{}e{}", i, e));
26-
validate(format!("{}e-{}", i, e));
25+
validate(&format!("{}e{}", i, e));
26+
validate(&format!("{}e-{}", i, e));
2727
}
2828
}
2929
}

branches/stable/src/etc/test-float-parse/subnorm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use _common::validate;
1616
fn main() {
1717
for bits in 0u32..(1 << 21) {
1818
let single: f32 = unsafe { transmute(bits) };
19-
validate(format!("{:e}", single));
19+
validate(&format!("{:e}", single));
2020
let double: f64 = unsafe { transmute(bits as u64) };
21-
validate(format!("{:e}", double));
21+
validate(&format!("{:e}", double));
2222
}
2323
}

branches/stable/src/etc/test-float-parse/tiny-pow10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use _common::validate;
1515
fn main() {
1616
for e in 301..327 {
1717
for i in 0..100000 {
18-
validate(format!("{}e-{}", i, e));
18+
validate(&format!("{}e-{}", i, e));
1919
}
2020
}
2121
}

0 commit comments

Comments
 (0)