libtest: rustfmt run
libtest: Whoops
This commit is contained in:
parent
94bd1216bb
commit
8b3fd98f4c
@ -14,10 +14,12 @@ pub(crate) trait OutputFormatter {
|
||||
fn write_run_start(&mut self, test_count: usize) -> io::Result<()>;
|
||||
fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()>;
|
||||
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()>;
|
||||
fn write_result(&mut self,
|
||||
desc: &TestDesc,
|
||||
result: &TestResult,
|
||||
stdout: &[u8]) -> io::Result<()>;
|
||||
fn write_result(
|
||||
&mut self,
|
||||
desc: &TestDesc,
|
||||
result: &TestResult,
|
||||
stdout: &[u8],
|
||||
) -> io::Result<()>;
|
||||
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool>;
|
||||
}
|
||||
|
||||
@ -34,11 +36,13 @@ pub(crate) struct HumanFormatter<T> {
|
||||
}
|
||||
|
||||
impl<T: Write> HumanFormatter<T> {
|
||||
pub fn new(out: OutputLocation<T>,
|
||||
use_color: bool,
|
||||
terse: bool,
|
||||
max_name_len: usize,
|
||||
is_multithreaded: bool) -> Self {
|
||||
pub fn new(
|
||||
out: OutputLocation<T>,
|
||||
use_color: bool,
|
||||
terse: bool,
|
||||
max_name_len: usize,
|
||||
is_multithreaded: bool,
|
||||
) -> Self {
|
||||
HumanFormatter {
|
||||
out,
|
||||
terse,
|
||||
@ -74,8 +78,12 @@ pub fn write_bench(&mut self) -> io::Result<()> {
|
||||
self.write_pretty("bench", term::color::CYAN)
|
||||
}
|
||||
|
||||
pub fn write_short_result(&mut self, verbose: &str, quiet: &str, color: term::color::Color)
|
||||
-> io::Result<()> {
|
||||
pub fn write_short_result(
|
||||
&mut self,
|
||||
verbose: &str,
|
||||
quiet: &str,
|
||||
color: term::color::Color,
|
||||
) -> io::Result<()> {
|
||||
if self.terse {
|
||||
self.write_pretty(quiet, color)?;
|
||||
if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
|
||||
@ -182,11 +190,7 @@ fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||
|
||||
impl<T: Write> OutputFormatter for HumanFormatter<T> {
|
||||
fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
|
||||
let noun = if test_count != 1 {
|
||||
"tests"
|
||||
} else {
|
||||
"test"
|
||||
};
|
||||
let noun = if test_count != 1 { "tests" } else { "test" };
|
||||
self.write_plain(&format!("\nrunning {} {}\n", test_count, noun))
|
||||
}
|
||||
|
||||
@ -224,9 +228,11 @@ fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||
self.write_test_name(desc)?;
|
||||
}
|
||||
|
||||
self.write_plain(&format!("test {} has been running for over {} seconds\n",
|
||||
desc.name,
|
||||
TEST_WARN_TIMEOUT_S))
|
||||
self.write_plain(&format!(
|
||||
"test {} has been running for over {} seconds\n",
|
||||
desc.name,
|
||||
TEST_WARN_TIMEOUT_S
|
||||
))
|
||||
}
|
||||
|
||||
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
@ -255,7 +261,8 @@ fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
state.allowed_fail,
|
||||
state.ignored,
|
||||
state.measured,
|
||||
state.filtered_out)
|
||||
state.filtered_out
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
|
||||
@ -263,7 +270,8 @@ fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
state.failed,
|
||||
state.ignored,
|
||||
state.measured,
|
||||
state.filtered_out)
|
||||
state.filtered_out
|
||||
)
|
||||
};
|
||||
|
||||
self.write_plain(&s)?;
|
||||
@ -273,7 +281,7 @@ fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
}
|
||||
|
||||
pub(crate) struct JsonFormatter<T> {
|
||||
out: OutputLocation<T>
|
||||
out: OutputLocation<T>,
|
||||
}
|
||||
|
||||
impl<T: Write> JsonFormatter<T> {
|
||||
@ -288,74 +296,83 @@ fn write_message(&mut self, s: &str) -> io::Result<()> {
|
||||
self.out.write_all(b"\n")
|
||||
}
|
||||
|
||||
fn write_event(&mut self,
|
||||
ty: &str,
|
||||
name: &str,
|
||||
evt: &str,
|
||||
extra: Option<String>) -> io::Result<()> {
|
||||
fn write_event(
|
||||
&mut self,
|
||||
ty: &str,
|
||||
name: &str,
|
||||
evt: &str,
|
||||
extra: Option<String>,
|
||||
) -> io::Result<()> {
|
||||
if let Some(extras) = extra {
|
||||
self.write_message(&*format!(r#"{{ "type": "{}", "name": "{}", "event": "{}", {} }}"#,
|
||||
ty,
|
||||
name,
|
||||
evt,
|
||||
extras))
|
||||
}
|
||||
else {
|
||||
self.write_message(&*format!(r#"{{ "type": "{}", "name": "{}", "event": "{}" }}"#,
|
||||
ty,
|
||||
name,
|
||||
evt))
|
||||
self.write_message(&*format!(
|
||||
r#"{{ "type": "{}", "name": "{}", "event": "{}", {} }}"#,
|
||||
ty,
|
||||
name,
|
||||
evt,
|
||||
extras
|
||||
))
|
||||
} else {
|
||||
self.write_message(&*format!(
|
||||
r#"{{ "type": "{}", "name": "{}", "event": "{}" }}"#,
|
||||
ty,
|
||||
name,
|
||||
evt
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Write> OutputFormatter for JsonFormatter<T> {
|
||||
fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
|
||||
self.write_message(
|
||||
&*format!(r#"{{ "type": "suite", "event": "started", "test_count": "{}" }}"#,
|
||||
test_count))
|
||||
self.write_message(&*format!(
|
||||
r#"{{ "type": "suite", "event": "started", "test_count": "{}" }}"#,
|
||||
test_count
|
||||
))
|
||||
}
|
||||
|
||||
fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||
self.write_message(&*format!(r#"{{ "type": "test", "event": "started", "name": "{}" }}"#,
|
||||
desc.name))
|
||||
self.write_message(&*format!(
|
||||
r#"{{ "type": "test", "event": "started", "name": "{}" }}"#,
|
||||
desc.name
|
||||
))
|
||||
}
|
||||
|
||||
fn write_result(&mut self,
|
||||
desc: &TestDesc,
|
||||
result: &TestResult,
|
||||
stdout: &[u8]) -> io::Result<()> {
|
||||
fn write_result(
|
||||
&mut self,
|
||||
desc: &TestDesc,
|
||||
result: &TestResult,
|
||||
stdout: &[u8],
|
||||
) -> io::Result<()> {
|
||||
match *result {
|
||||
TrOk => {
|
||||
self.write_event("test", desc.name.as_slice(), "ok", None)
|
||||
},
|
||||
TrOk => self.write_event("test", desc.name.as_slice(), "ok", None),
|
||||
|
||||
TrFailed => {
|
||||
let extra_data = if stdout.len() > 0 {
|
||||
Some(format!(r#""stdout": "{}""#,
|
||||
EscapedString(String::from_utf8_lossy(stdout))))
|
||||
}
|
||||
else {
|
||||
Some(format!(
|
||||
r#""stdout": "{}""#,
|
||||
EscapedString(String::from_utf8_lossy(stdout))
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.write_event("test", desc.name.as_slice(), "failed", extra_data)
|
||||
},
|
||||
}
|
||||
|
||||
TrFailedMsg(ref m) => {
|
||||
self.write_event("test",
|
||||
desc.name.as_slice(),
|
||||
"failed",
|
||||
Some(format!(r#""message": "{}""#, EscapedString(m))))
|
||||
},
|
||||
self.write_event(
|
||||
"test",
|
||||
desc.name.as_slice(),
|
||||
"failed",
|
||||
Some(format!(r#""message": "{}""#, EscapedString(m))),
|
||||
)
|
||||
}
|
||||
|
||||
TrIgnored => {
|
||||
self.write_event("test", desc.name.as_slice(), "ignored", None)
|
||||
},
|
||||
TrIgnored => self.write_event("test", desc.name.as_slice(), "ignored", None),
|
||||
|
||||
TrAllowedFail => {
|
||||
self.write_event("test", desc.name.as_slice(), "allowed_failure", None)
|
||||
},
|
||||
}
|
||||
|
||||
TrBench(ref bs) => {
|
||||
let median = bs.ns_iter_summ.median as usize;
|
||||
@ -363,33 +380,37 @@ fn write_result(&mut self,
|
||||
|
||||
let mbps = if bs.mb_s == 0 {
|
||||
"".into()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
format!(r#", "mib_per_second": {}"#, bs.mb_s)
|
||||
};
|
||||
|
||||
let line = format!("{{ \"type\": \"bench\", \
|
||||
let line = format!(
|
||||
"{{ \"type\": \"bench\", \
|
||||
\"name\": \"{}\", \
|
||||
\"median\": {}, \
|
||||
\"deviation\": {}{} }}",
|
||||
desc.name,
|
||||
median,
|
||||
deviation,
|
||||
mbps);
|
||||
desc.name,
|
||||
median,
|
||||
deviation,
|
||||
mbps
|
||||
);
|
||||
|
||||
self.write_message(&*line)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||
self.write_message(&*format!(r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#,
|
||||
desc.name))
|
||||
self.write_message(&*format!(
|
||||
r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#,
|
||||
desc.name
|
||||
))
|
||||
}
|
||||
|
||||
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
|
||||
self.write_message(&*format!("{{ \"type\": \"suite\", \
|
||||
self.write_message(&*format!(
|
||||
"{{ \"type\": \"suite\", \
|
||||
\"event\": \"{}\", \
|
||||
\"passed\": {}, \
|
||||
\"failed\": {}, \
|
||||
@ -403,7 +424,8 @@ fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
|
||||
state.allowed_fail,
|
||||
state.ignored,
|
||||
state.measured,
|
||||
state.filtered_out))?;
|
||||
state.filtered_out
|
||||
))?;
|
||||
|
||||
Ok(state.failed == 0)
|
||||
}
|
||||
@ -454,7 +476,9 @@ fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
b'\x1e' => "\\u001e",
|
||||
b'\x1f' => "\\u001f",
|
||||
b'\x7f' => "\\u007f",
|
||||
_ => { continue; }
|
||||
_ => {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
if start < i {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -400,16 +400,18 @@ fn test_norm2() {
|
||||
}
|
||||
#[test]
|
||||
fn test_norm10narrow() {
|
||||
let val = &[966.0000000000,
|
||||
985.0000000000,
|
||||
1110.0000000000,
|
||||
848.0000000000,
|
||||
821.0000000000,
|
||||
975.0000000000,
|
||||
962.0000000000,
|
||||
1157.0000000000,
|
||||
1217.0000000000,
|
||||
955.0000000000];
|
||||
let val = &[
|
||||
966.0000000000,
|
||||
985.0000000000,
|
||||
1110.0000000000,
|
||||
848.0000000000,
|
||||
821.0000000000,
|
||||
975.0000000000,
|
||||
962.0000000000,
|
||||
1157.0000000000,
|
||||
1217.0000000000,
|
||||
955.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 9996.0000000000,
|
||||
min: 821.0000000000,
|
||||
@ -428,16 +430,18 @@ fn test_norm10narrow() {
|
||||
}
|
||||
#[test]
|
||||
fn test_norm10medium() {
|
||||
let val = &[954.0000000000,
|
||||
1064.0000000000,
|
||||
855.0000000000,
|
||||
1000.0000000000,
|
||||
743.0000000000,
|
||||
1084.0000000000,
|
||||
704.0000000000,
|
||||
1023.0000000000,
|
||||
357.0000000000,
|
||||
869.0000000000];
|
||||
let val = &[
|
||||
954.0000000000,
|
||||
1064.0000000000,
|
||||
855.0000000000,
|
||||
1000.0000000000,
|
||||
743.0000000000,
|
||||
1084.0000000000,
|
||||
704.0000000000,
|
||||
1023.0000000000,
|
||||
357.0000000000,
|
||||
869.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 8653.0000000000,
|
||||
min: 357.0000000000,
|
||||
@ -456,16 +460,18 @@ fn test_norm10medium() {
|
||||
}
|
||||
#[test]
|
||||
fn test_norm10wide() {
|
||||
let val = &[505.0000000000,
|
||||
497.0000000000,
|
||||
1591.0000000000,
|
||||
887.0000000000,
|
||||
1026.0000000000,
|
||||
136.0000000000,
|
||||
1580.0000000000,
|
||||
940.0000000000,
|
||||
754.0000000000,
|
||||
1433.0000000000];
|
||||
let val = &[
|
||||
505.0000000000,
|
||||
497.0000000000,
|
||||
1591.0000000000,
|
||||
887.0000000000,
|
||||
1026.0000000000,
|
||||
136.0000000000,
|
||||
1580.0000000000,
|
||||
940.0000000000,
|
||||
754.0000000000,
|
||||
1433.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 9349.0000000000,
|
||||
min: 136.0000000000,
|
||||
@ -484,31 +490,33 @@ fn test_norm10wide() {
|
||||
}
|
||||
#[test]
|
||||
fn test_norm25verynarrow() {
|
||||
let val = &[991.0000000000,
|
||||
1018.0000000000,
|
||||
998.0000000000,
|
||||
1013.0000000000,
|
||||
974.0000000000,
|
||||
1007.0000000000,
|
||||
1014.0000000000,
|
||||
999.0000000000,
|
||||
1011.0000000000,
|
||||
978.0000000000,
|
||||
985.0000000000,
|
||||
999.0000000000,
|
||||
983.0000000000,
|
||||
982.0000000000,
|
||||
1015.0000000000,
|
||||
1002.0000000000,
|
||||
977.0000000000,
|
||||
948.0000000000,
|
||||
1040.0000000000,
|
||||
974.0000000000,
|
||||
996.0000000000,
|
||||
989.0000000000,
|
||||
1015.0000000000,
|
||||
994.0000000000,
|
||||
1024.0000000000];
|
||||
let val = &[
|
||||
991.0000000000,
|
||||
1018.0000000000,
|
||||
998.0000000000,
|
||||
1013.0000000000,
|
||||
974.0000000000,
|
||||
1007.0000000000,
|
||||
1014.0000000000,
|
||||
999.0000000000,
|
||||
1011.0000000000,
|
||||
978.0000000000,
|
||||
985.0000000000,
|
||||
999.0000000000,
|
||||
983.0000000000,
|
||||
982.0000000000,
|
||||
1015.0000000000,
|
||||
1002.0000000000,
|
||||
977.0000000000,
|
||||
948.0000000000,
|
||||
1040.0000000000,
|
||||
974.0000000000,
|
||||
996.0000000000,
|
||||
989.0000000000,
|
||||
1015.0000000000,
|
||||
994.0000000000,
|
||||
1024.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 24926.0000000000,
|
||||
min: 948.0000000000,
|
||||
@ -527,16 +535,18 @@ fn test_norm25verynarrow() {
|
||||
}
|
||||
#[test]
|
||||
fn test_exp10a() {
|
||||
let val = &[23.0000000000,
|
||||
11.0000000000,
|
||||
2.0000000000,
|
||||
57.0000000000,
|
||||
4.0000000000,
|
||||
12.0000000000,
|
||||
5.0000000000,
|
||||
29.0000000000,
|
||||
3.0000000000,
|
||||
21.0000000000];
|
||||
let val = &[
|
||||
23.0000000000,
|
||||
11.0000000000,
|
||||
2.0000000000,
|
||||
57.0000000000,
|
||||
4.0000000000,
|
||||
12.0000000000,
|
||||
5.0000000000,
|
||||
29.0000000000,
|
||||
3.0000000000,
|
||||
21.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 167.0000000000,
|
||||
min: 2.0000000000,
|
||||
@ -555,16 +565,18 @@ fn test_exp10a() {
|
||||
}
|
||||
#[test]
|
||||
fn test_exp10b() {
|
||||
let val = &[24.0000000000,
|
||||
17.0000000000,
|
||||
6.0000000000,
|
||||
38.0000000000,
|
||||
25.0000000000,
|
||||
7.0000000000,
|
||||
51.0000000000,
|
||||
2.0000000000,
|
||||
61.0000000000,
|
||||
32.0000000000];
|
||||
let val = &[
|
||||
24.0000000000,
|
||||
17.0000000000,
|
||||
6.0000000000,
|
||||
38.0000000000,
|
||||
25.0000000000,
|
||||
7.0000000000,
|
||||
51.0000000000,
|
||||
2.0000000000,
|
||||
61.0000000000,
|
||||
32.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 263.0000000000,
|
||||
min: 2.0000000000,
|
||||
@ -583,16 +595,18 @@ fn test_exp10b() {
|
||||
}
|
||||
#[test]
|
||||
fn test_exp10c() {
|
||||
let val = &[71.0000000000,
|
||||
2.0000000000,
|
||||
32.0000000000,
|
||||
1.0000000000,
|
||||
6.0000000000,
|
||||
28.0000000000,
|
||||
13.0000000000,
|
||||
37.0000000000,
|
||||
16.0000000000,
|
||||
36.0000000000];
|
||||
let val = &[
|
||||
71.0000000000,
|
||||
2.0000000000,
|
||||
32.0000000000,
|
||||
1.0000000000,
|
||||
6.0000000000,
|
||||
28.0000000000,
|
||||
13.0000000000,
|
||||
37.0000000000,
|
||||
16.0000000000,
|
||||
36.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 242.0000000000,
|
||||
min: 1.0000000000,
|
||||
@ -611,31 +625,33 @@ fn test_exp10c() {
|
||||
}
|
||||
#[test]
|
||||
fn test_exp25() {
|
||||
let val = &[3.0000000000,
|
||||
24.0000000000,
|
||||
1.0000000000,
|
||||
19.0000000000,
|
||||
7.0000000000,
|
||||
5.0000000000,
|
||||
30.0000000000,
|
||||
39.0000000000,
|
||||
31.0000000000,
|
||||
13.0000000000,
|
||||
25.0000000000,
|
||||
48.0000000000,
|
||||
1.0000000000,
|
||||
6.0000000000,
|
||||
42.0000000000,
|
||||
63.0000000000,
|
||||
2.0000000000,
|
||||
12.0000000000,
|
||||
108.0000000000,
|
||||
26.0000000000,
|
||||
1.0000000000,
|
||||
7.0000000000,
|
||||
44.0000000000,
|
||||
25.0000000000,
|
||||
11.0000000000];
|
||||
let val = &[
|
||||
3.0000000000,
|
||||
24.0000000000,
|
||||
1.0000000000,
|
||||
19.0000000000,
|
||||
7.0000000000,
|
||||
5.0000000000,
|
||||
30.0000000000,
|
||||
39.0000000000,
|
||||
31.0000000000,
|
||||
13.0000000000,
|
||||
25.0000000000,
|
||||
48.0000000000,
|
||||
1.0000000000,
|
||||
6.0000000000,
|
||||
42.0000000000,
|
||||
63.0000000000,
|
||||
2.0000000000,
|
||||
12.0000000000,
|
||||
108.0000000000,
|
||||
26.0000000000,
|
||||
1.0000000000,
|
||||
7.0000000000,
|
||||
44.0000000000,
|
||||
25.0000000000,
|
||||
11.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 593.0000000000,
|
||||
min: 1.0000000000,
|
||||
@ -654,31 +670,33 @@ fn test_exp25() {
|
||||
}
|
||||
#[test]
|
||||
fn test_binom25() {
|
||||
let val = &[18.0000000000,
|
||||
17.0000000000,
|
||||
27.0000000000,
|
||||
15.0000000000,
|
||||
21.0000000000,
|
||||
25.0000000000,
|
||||
17.0000000000,
|
||||
24.0000000000,
|
||||
25.0000000000,
|
||||
24.0000000000,
|
||||
26.0000000000,
|
||||
26.0000000000,
|
||||
23.0000000000,
|
||||
15.0000000000,
|
||||
23.0000000000,
|
||||
17.0000000000,
|
||||
18.0000000000,
|
||||
18.0000000000,
|
||||
21.0000000000,
|
||||
16.0000000000,
|
||||
15.0000000000,
|
||||
31.0000000000,
|
||||
20.0000000000,
|
||||
17.0000000000,
|
||||
15.0000000000];
|
||||
let val = &[
|
||||
18.0000000000,
|
||||
17.0000000000,
|
||||
27.0000000000,
|
||||
15.0000000000,
|
||||
21.0000000000,
|
||||
25.0000000000,
|
||||
17.0000000000,
|
||||
24.0000000000,
|
||||
25.0000000000,
|
||||
24.0000000000,
|
||||
26.0000000000,
|
||||
26.0000000000,
|
||||
23.0000000000,
|
||||
15.0000000000,
|
||||
23.0000000000,
|
||||
17.0000000000,
|
||||
18.0000000000,
|
||||
18.0000000000,
|
||||
21.0000000000,
|
||||
16.0000000000,
|
||||
15.0000000000,
|
||||
31.0000000000,
|
||||
20.0000000000,
|
||||
17.0000000000,
|
||||
15.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 514.0000000000,
|
||||
min: 15.0000000000,
|
||||
@ -697,31 +715,33 @@ fn test_binom25() {
|
||||
}
|
||||
#[test]
|
||||
fn test_pois25lambda30() {
|
||||
let val = &[27.0000000000,
|
||||
33.0000000000,
|
||||
34.0000000000,
|
||||
34.0000000000,
|
||||
24.0000000000,
|
||||
39.0000000000,
|
||||
28.0000000000,
|
||||
27.0000000000,
|
||||
31.0000000000,
|
||||
28.0000000000,
|
||||
38.0000000000,
|
||||
21.0000000000,
|
||||
33.0000000000,
|
||||
36.0000000000,
|
||||
29.0000000000,
|
||||
37.0000000000,
|
||||
32.0000000000,
|
||||
34.0000000000,
|
||||
31.0000000000,
|
||||
39.0000000000,
|
||||
25.0000000000,
|
||||
31.0000000000,
|
||||
32.0000000000,
|
||||
40.0000000000,
|
||||
24.0000000000];
|
||||
let val = &[
|
||||
27.0000000000,
|
||||
33.0000000000,
|
||||
34.0000000000,
|
||||
34.0000000000,
|
||||
24.0000000000,
|
||||
39.0000000000,
|
||||
28.0000000000,
|
||||
27.0000000000,
|
||||
31.0000000000,
|
||||
28.0000000000,
|
||||
38.0000000000,
|
||||
21.0000000000,
|
||||
33.0000000000,
|
||||
36.0000000000,
|
||||
29.0000000000,
|
||||
37.0000000000,
|
||||
32.0000000000,
|
||||
34.0000000000,
|
||||
31.0000000000,
|
||||
39.0000000000,
|
||||
25.0000000000,
|
||||
31.0000000000,
|
||||
32.0000000000,
|
||||
40.0000000000,
|
||||
24.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 787.0000000000,
|
||||
min: 21.0000000000,
|
||||
@ -740,31 +760,33 @@ fn test_pois25lambda30() {
|
||||
}
|
||||
#[test]
|
||||
fn test_pois25lambda40() {
|
||||
let val = &[42.0000000000,
|
||||
50.0000000000,
|
||||
42.0000000000,
|
||||
46.0000000000,
|
||||
34.0000000000,
|
||||
45.0000000000,
|
||||
34.0000000000,
|
||||
49.0000000000,
|
||||
39.0000000000,
|
||||
28.0000000000,
|
||||
40.0000000000,
|
||||
35.0000000000,
|
||||
37.0000000000,
|
||||
39.0000000000,
|
||||
46.0000000000,
|
||||
44.0000000000,
|
||||
32.0000000000,
|
||||
45.0000000000,
|
||||
42.0000000000,
|
||||
37.0000000000,
|
||||
48.0000000000,
|
||||
42.0000000000,
|
||||
33.0000000000,
|
||||
42.0000000000,
|
||||
48.0000000000];
|
||||
let val = &[
|
||||
42.0000000000,
|
||||
50.0000000000,
|
||||
42.0000000000,
|
||||
46.0000000000,
|
||||
34.0000000000,
|
||||
45.0000000000,
|
||||
34.0000000000,
|
||||
49.0000000000,
|
||||
39.0000000000,
|
||||
28.0000000000,
|
||||
40.0000000000,
|
||||
35.0000000000,
|
||||
37.0000000000,
|
||||
39.0000000000,
|
||||
46.0000000000,
|
||||
44.0000000000,
|
||||
32.0000000000,
|
||||
45.0000000000,
|
||||
42.0000000000,
|
||||
37.0000000000,
|
||||
48.0000000000,
|
||||
42.0000000000,
|
||||
33.0000000000,
|
||||
42.0000000000,
|
||||
48.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 1019.0000000000,
|
||||
min: 28.0000000000,
|
||||
@ -783,31 +805,33 @@ fn test_pois25lambda40() {
|
||||
}
|
||||
#[test]
|
||||
fn test_pois25lambda50() {
|
||||
let val = &[45.0000000000,
|
||||
43.0000000000,
|
||||
44.0000000000,
|
||||
61.0000000000,
|
||||
51.0000000000,
|
||||
53.0000000000,
|
||||
59.0000000000,
|
||||
52.0000000000,
|
||||
49.0000000000,
|
||||
51.0000000000,
|
||||
51.0000000000,
|
||||
50.0000000000,
|
||||
49.0000000000,
|
||||
56.0000000000,
|
||||
42.0000000000,
|
||||
52.0000000000,
|
||||
51.0000000000,
|
||||
43.0000000000,
|
||||
48.0000000000,
|
||||
48.0000000000,
|
||||
50.0000000000,
|
||||
42.0000000000,
|
||||
43.0000000000,
|
||||
42.0000000000,
|
||||
60.0000000000];
|
||||
let val = &[
|
||||
45.0000000000,
|
||||
43.0000000000,
|
||||
44.0000000000,
|
||||
61.0000000000,
|
||||
51.0000000000,
|
||||
53.0000000000,
|
||||
59.0000000000,
|
||||
52.0000000000,
|
||||
49.0000000000,
|
||||
51.0000000000,
|
||||
51.0000000000,
|
||||
50.0000000000,
|
||||
49.0000000000,
|
||||
56.0000000000,
|
||||
42.0000000000,
|
||||
52.0000000000,
|
||||
51.0000000000,
|
||||
43.0000000000,
|
||||
48.0000000000,
|
||||
48.0000000000,
|
||||
50.0000000000,
|
||||
42.0000000000,
|
||||
43.0000000000,
|
||||
42.0000000000,
|
||||
60.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 1235.0000000000,
|
||||
min: 42.0000000000,
|
||||
@ -826,31 +850,33 @@ fn test_pois25lambda50() {
|
||||
}
|
||||
#[test]
|
||||
fn test_unif25() {
|
||||
let val = &[99.0000000000,
|
||||
55.0000000000,
|
||||
92.0000000000,
|
||||
79.0000000000,
|
||||
14.0000000000,
|
||||
2.0000000000,
|
||||
33.0000000000,
|
||||
49.0000000000,
|
||||
3.0000000000,
|
||||
32.0000000000,
|
||||
84.0000000000,
|
||||
59.0000000000,
|
||||
22.0000000000,
|
||||
86.0000000000,
|
||||
76.0000000000,
|
||||
31.0000000000,
|
||||
29.0000000000,
|
||||
11.0000000000,
|
||||
41.0000000000,
|
||||
53.0000000000,
|
||||
45.0000000000,
|
||||
44.0000000000,
|
||||
98.0000000000,
|
||||
98.0000000000,
|
||||
7.0000000000];
|
||||
let val = &[
|
||||
99.0000000000,
|
||||
55.0000000000,
|
||||
92.0000000000,
|
||||
79.0000000000,
|
||||
14.0000000000,
|
||||
2.0000000000,
|
||||
33.0000000000,
|
||||
49.0000000000,
|
||||
3.0000000000,
|
||||
32.0000000000,
|
||||
84.0000000000,
|
||||
59.0000000000,
|
||||
22.0000000000,
|
||||
86.0000000000,
|
||||
76.0000000000,
|
||||
31.0000000000,
|
||||
29.0000000000,
|
||||
11.0000000000,
|
||||
41.0000000000,
|
||||
53.0000000000,
|
||||
45.0000000000,
|
||||
44.0000000000,
|
||||
98.0000000000,
|
||||
98.0000000000,
|
||||
7.0000000000,
|
||||
];
|
||||
let summ = &Summary {
|
||||
sum: 1242.0000000000,
|
||||
min: 2.0000000000,
|
||||
@ -885,18 +911,14 @@ mod bench {
|
||||
|
||||
#[bench]
|
||||
pub fn sum_three_items(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
[1e20f64, 1.5f64, -1e20f64].sum();
|
||||
})
|
||||
b.iter(|| { [1e20f64, 1.5f64, -1e20f64].sum(); })
|
||||
}
|
||||
#[bench]
|
||||
pub fn sum_many_f64(b: &mut Bencher) {
|
||||
let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60];
|
||||
let v = (0..500).map(|i| nums[i % 5]).collect::<Vec<_>>();
|
||||
|
||||
b.iter(|| {
|
||||
v.sum();
|
||||
})
|
||||
b.iter(|| { v.sum(); })
|
||||
}
|
||||
|
||||
#[bench]
|
||||
|
Loading…
Reference in New Issue
Block a user