mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 14:49:21 +00:00
test: test advanced mode functionality
This commit is contained in:
parent
3d6e6e8bfe
commit
cda7c975b6
1 changed files with 49 additions and 1 deletions
|
@ -3,7 +3,7 @@ mod test {
|
|||
|
||||
use crate::helper::{
|
||||
p2pool::{PrivP2poolLocalApi, PrivP2poolNetworkApi},
|
||||
xvb::{algorithm::calcul_donated_time, priv_stats::RuntimeMode, rounds::round_type},
|
||||
xvb::{algorithm::calcul_donated_time, priv_stats::RuntimeMode, priv_stats::RuntimeDonationLevel, rounds::round_type},
|
||||
Helper, Process, ProcessName, ProcessState,
|
||||
};
|
||||
|
||||
|
@ -527,6 +527,7 @@ Uptime = 0h 2m 4s
|
|||
async fn corr(client: &Client) -> XvbPubStats {
|
||||
XvbPubStats::request_api(client).await.unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn algorithm_time_given() {
|
||||
let gui_api_xvb = Arc::new(Mutex::new(PubXvbApi::new()));
|
||||
|
@ -777,4 +778,51 @@ Uptime = 0h 2m 4s
|
|||
/ 1000.0;
|
||||
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::DonorVip));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_xvb_advanced_options () {
|
||||
let gui_api_xvb = Arc::new(Mutex::new(PubXvbApi::new()));
|
||||
let gui_api_p2pool = Arc::new(Mutex::new(PubP2poolApi::new()));
|
||||
let gui_api_xmrig = Arc::new(Mutex::new(PubXmrigApi::new()));
|
||||
let state_p2pool = P2pool::default();
|
||||
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 95000000;
|
||||
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||
lock!(gui_api_xmrig).hashrate_raw_15m = 5000.0;
|
||||
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManuallyDonate;
|
||||
lock!(gui_api_xvb).stats_priv.runtime_manual_amount = 500.0;
|
||||
|
||||
let given_time = calcul_donated_time(
|
||||
lock!(gui_api_xmrig).hashrate_raw_15m,
|
||||
&gui_api_p2pool,
|
||||
&gui_api_xvb,
|
||||
&state_p2pool,
|
||||
);
|
||||
|
||||
assert_eq!(given_time, 60);
|
||||
|
||||
|
||||
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManuallyKeep;
|
||||
|
||||
let given_time = calcul_donated_time(
|
||||
lock!(gui_api_xmrig).hashrate_raw_15m,
|
||||
&gui_api_p2pool,
|
||||
&gui_api_xvb,
|
||||
&state_p2pool,
|
||||
);
|
||||
assert_eq!(given_time, 540);
|
||||
|
||||
|
||||
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManualDonationLevel;
|
||||
lock!(gui_api_xvb).stats_priv.runtime_manual_donation_level = RuntimeDonationLevel::Donor;
|
||||
|
||||
|
||||
let given_time = calcul_donated_time(
|
||||
lock!(gui_api_xmrig).hashrate_raw_15m,
|
||||
&gui_api_p2pool,
|
||||
&gui_api_xvb,
|
||||
&state_p2pool,
|
||||
);
|
||||
assert_eq!(given_time, 120);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue