From 60f783d11721a467bfc5be7c8827351edd3622fe Mon Sep 17 00:00:00 2001 From: bendn Date: Mon, 9 Oct 2023 19:40:26 +0700 Subject: [PATCH] add bench test --- src/libtest.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libtest.rs b/src/libtest.rs index ba42fc2b..fbf3135f 100644 --- a/src/libtest.rs +++ b/src/libtest.rs @@ -20,7 +20,7 @@ pub enum SuiteEvent { failed: usize, /// number of tests that were ignored ignored: usize, - /// i think its something to do with benchmarks? + /// number of benchmarks run measured: usize, /// i think this is based on what you specify in the cargo test argument filtered_out: usize, @@ -145,9 +145,11 @@ fn deser() { ]; run![ - r#"{ "type": "suite", "event": "started", "test_count": 1 }"# parses to TestMessage::Suite(SuiteEvent::Started { test_count: 1 }), + r#"{ "type": "suite", "event": "started", "test_count": 2 }"# parses to TestMessage::Suite(SuiteEvent::Started { test_count: 2 }), r#"{ "type": "test", "event": "started", "name": "fail" }"# parses to TestMessage::Test(TestEvent::Started { name: "fail".into() }), + r#"{ "type": "test", "event": "started", "name": "benc" }"# parses to TestMessage::Test(TestEvent::Started { name: "benc".into() }), + r#"{ "type": "bench", "name": "benc", "median": 0, "deviation": 0 }"# parses to TestMessage::Bench { name: "benc".into(), median: 0., deviation: 0., mib_per_second: None }, r#"{ "type": "test", "name": "fail", "event": "failed", "exec_time": 0.000081092, "stdout": "thread 'fail' panicked" }"# parses to TestMessage::Test(TestEvent::Failed { name: "fail".into(), exec_time: 0.000081092, stdout: Some("thread 'fail' panicked".into()), reason: None, message: None} ), - r#"{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.000731068 }"# parses to TestMessage::Suite(SuiteEvent::Failed { passed: 0, failed: 1, ignored: 0, measured: 0, filtered_out: 0, exec_time: 0.000731068 }) + r#"{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 1, "filtered_out": 0, "exec_time": 0.000731068 }"# parses to TestMessage::Suite(SuiteEvent::Failed { passed: 0, failed: 1, ignored: 0, measured: 1, filtered_out: 0, exec_time: 0.000731068 }) ]; }