From b8821f5c78da0e8da7d03676c9ef2d6d640de658 Mon Sep 17 00:00:00 2001 From: r12f Date: Sat, 12 Mar 2022 23:13:15 -0800 Subject: [PATCH] update. --- src/ping_runners/ping_result.rs | 2 +- tests/ping_runner_core_tests.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ping_runners/ping_result.rs b/src/ping_runners/ping_result.rs index c99440f..c9680e8 100644 --- a/src/ping_runners/ping_result.rs +++ b/src/ping_runners/ping_result.rs @@ -140,7 +140,7 @@ impl PingResult { source_port: self.source().port(), is_warmup: self.is_warmup(), is_succeeded: self.is_succeeded(), - rtt_in_ms: self.round_trip_time().as_millis() as f64, + rtt_in_ms: self.round_trip_time().as_micros() as f64 / 1000.0, is_timed_out: self.is_timed_out(), preparation_error, ping_error, diff --git a/tests/ping_runner_core_tests.rs b/tests/ping_runner_core_tests.rs index 6c7534e..31225a2 100644 --- a/tests/ping_runner_core_tests.rs +++ b/tests/ping_runner_core_tests.rs @@ -27,15 +27,15 @@ fn ping_with_rnp_core_should_work() { let results = actual_ping_results.lock().unwrap(); assert_eq!( vec![ - MockPingClientResult::Success(Duration::from_millis(10)), + MockPingClientResult::Success(Duration::from_micros(12345)), MockPingClientResult::Timeout, MockPingClientResult::PreparationFailed, - MockPingClientResult::Success(Duration::from_millis(10)), + MockPingClientResult::Success(Duration::from_micros(12345)), MockPingClientResult::Timeout, MockPingClientResult::PreparationFailed, MockPingClientResult::PingFailed, - MockPingClientResult::AppHandshakeFailed(Duration::from_millis(20)), - MockPingClientResult::DisconnectFailed(Duration::from_millis(30)), + MockPingClientResult::AppHandshakeFailed(Duration::from_micros(23456)), + MockPingClientResult::DisconnectFailed(Duration::from_micros(34567)), ], *results ); @@ -153,12 +153,12 @@ fn create_mock_rnp_config( Some(Box::new(MockPingClient::new( config, vec![ - MockPingClientResult::Success(Duration::from_millis(10)), + MockPingClientResult::Success(Duration::from_micros(12345)), MockPingClientResult::Timeout, MockPingClientResult::PreparationFailed, MockPingClientResult::PingFailed, - MockPingClientResult::AppHandshakeFailed(Duration::from_millis(20)), - MockPingClientResult::DisconnectFailed(Duration::from_millis(30)), + MockPingClientResult::AppHandshakeFailed(Duration::from_micros(23456)), + MockPingClientResult::DisconnectFailed(Duration::from_micros(34567)), ], ))) }),