Skip to content

Commit

Permalink
GH-673: Fixing some weak points in tests (#229)
Browse files Browse the repository at this point in the history
* testing_area_fixes: one test counted on a premise that could not be matched with the test tooling we had; I created a new kind and fixed the test

* GH-673: making three tests into more stronger ones; these will embrace also certain use of self.handle_scan()

* GH-673: first phase of smooth use of stop conditions for recorder

* GH-673: first moment hitting wall hard

* GH-673: StopConditions considered implemented; might change some details

* GH-673: added some tests... of test code...

* GH-673: finishing tests and adding required PartialEq and Eq traits to some messages

* GH-673: most of things from the review addressed; preparing for reducing the Single cond, experimenting

* GH-673: review answered

* GH-673: adding notify later 'facelift'

* GH-673: simplifying default impl for NotifyLaterHandler

* GH-673: review issues are gone; I added some little refactoring for ScannerFactories in AccountantBuilder

---------

Co-authored-by: Bert <[email protected]>
  • Loading branch information
bertllll and Bert authored Mar 1, 2023
1 parent 908dddb commit 646eac2
Show file tree
Hide file tree
Showing 45 changed files with 926 additions and 515 deletions.
4 changes: 2 additions & 2 deletions masq/src/commands/change_password_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use clap::{App, Arg, SubCommand};
use masq_lib::messages::{
UiChangePasswordRequest, UiChangePasswordResponse, UiNewPasswordBroadcast,
};
use masq_lib::{as_any_impl, short_writeln};
use masq_lib::{implement_as_any, short_writeln};
#[cfg(test)]
use std::any::Any;
use std::io::Write;
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Command for ChangePasswordCommand {
Ok(())
}

as_any_impl!();
implement_as_any!();
}

pub fn change_password_subcommand() -> App<'static, 'static> {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/check_password_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::commands::commands_common::{
transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, Arg, SubCommand};
use masq_lib::as_any_impl;
use masq_lib::implement_as_any;
use masq_lib::messages::{UiCheckPasswordRequest, UiCheckPasswordResponse};
use masq_lib::short_writeln;
#[cfg(test)]
Expand Down Expand Up @@ -52,7 +52,7 @@ impl Command for CheckPasswordCommand {
Ok(())
}

as_any_impl!();
implement_as_any!();
}

impl CheckPasswordCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/configuration_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::commands::commands_common::{
dump_parameter_line, transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, Arg, SubCommand};
use masq_lib::as_any_impl;
use masq_lib::constants::NODE_NOT_RUNNING_ERROR;
use masq_lib::implement_as_any;
use masq_lib::messages::{UiConfigurationRequest, UiConfigurationResponse};
use masq_lib::short_writeln;
#[cfg(test)]
Expand Down Expand Up @@ -65,7 +65,7 @@ impl Command for ConfigurationCommand {
}
}

as_any_impl!();
implement_as_any!();
}

impl ConfigurationCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/connection_status_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::commands::commands_common::{
transaction, Command, CommandError, STANDARD_COMMAND_TIMEOUT_MILLIS,
};
use clap::{App, SubCommand};
use masq_lib::as_any_impl;
use masq_lib::constants::NODE_NOT_RUNNING_ERROR;
use masq_lib::implement_as_any;
use masq_lib::messages::{
UiConnectionStage, UiConnectionStatusRequest, UiConnectionStatusResponse,
};
Expand Down Expand Up @@ -65,7 +65,7 @@ impl Command for ConnectionStatusCommand {
}
}

as_any_impl!();
implement_as_any!();
}

impl ConnectionStatusCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/generate_wallets_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, SubCommand};
use lazy_static::lazy_static;
use masq_lib::as_any_impl;
use masq_lib::implement_as_any;
use masq_lib::messages::{UiGenerateSeedSpec, UiGenerateWalletsRequest, UiGenerateWalletsResponse};
use masq_lib::short_writeln;
use masq_lib::utils::DEFAULT_CONSUMING_DERIVATION_PATH;
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Command for GenerateWalletsCommand {
Ok(())
}

as_any_impl!();
implement_as_any!();
}

pub fn generate_wallets_subcommand() -> App<'static, 'static> {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/recover_wallets_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, ArgGroup, SubCommand};
use itertools::{Either, Itertools};
use masq_lib::as_any_impl;
use masq_lib::implement_as_any;
use masq_lib::messages::{UiRecoverSeedSpec, UiRecoverWalletsRequest, UiRecoverWalletsResponse};
use masq_lib::short_writeln;
#[cfg(test)]
Expand Down Expand Up @@ -121,7 +121,7 @@ impl Command for RecoverWalletsCommand {
Ok(())
}

as_any_impl!();
implement_as_any!();
}

const RECOVER_WALLETS_ABOUT: &str =
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/set_configuration_command.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::command_context::CommandContext;
use crate::commands::commands_common::{transaction, Command, CommandError};
use clap::{App, Arg, ArgGroup, SubCommand};
use masq_lib::as_any_impl;
use masq_lib::implement_as_any;
use masq_lib::messages::{UiSetConfigurationRequest, UiSetConfigurationResponse};
use masq_lib::shared_schema::common_validators;
use masq_lib::shared_schema::GAS_PRICE_HELP;
Expand Down Expand Up @@ -55,7 +55,7 @@ impl Command for SetConfigurationCommand {
Ok(())
}

as_any_impl!();
implement_as_any!();
}

const SET_CONFIGURATION_ABOUT: &str =
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/setup_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::command_context::CommandContext;
use crate::commands::commands_common::{transaction, Command, CommandError};
use crate::terminal::terminal_interface::TerminalWrapper;
use clap::{value_t, App, SubCommand};
use masq_lib::as_any_impl;
use masq_lib::constants::SETUP_ERROR;
use masq_lib::implement_as_any;
use masq_lib::messages::{
UiSetupBroadcast, UiSetupInner, UiSetupRequest, UiSetupRequestValue, UiSetupResponse,
};
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Command for SetupCommand {
Err(e) => Err(e),
}
}
as_any_impl!();
implement_as_any!();
}

impl SetupCommand {
Expand Down
4 changes: 2 additions & 2 deletions masq/src/commands/wallet_addresses_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::commands::commands_common::{
};
use clap::{App, Arg, SubCommand};
use masq_lib::messages::{UiWalletAddressesRequest, UiWalletAddressesResponse};
use masq_lib::{as_any_impl, short_writeln};
use masq_lib::{implement_as_any, short_writeln};
#[cfg(test)]
use std::any::Any;

Expand Down Expand Up @@ -68,7 +68,7 @@ impl Command for WalletAddressesCommand {
);
Ok(())
}
as_any_impl!();
implement_as_any!();
}

#[cfg(test)]
Expand Down
6 changes: 3 additions & 3 deletions masq/src/communications/broadcast_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use masq_lib::messages::{
};
use masq_lib::ui_gateway::MessageBody;
use masq_lib::utils::ExpectValue;
use masq_lib::{as_any_dcl, as_any_impl, short_writeln};
use masq_lib::{declare_as_any, implement_as_any, short_writeln};
use std::fmt::Debug;
use std::io::Write;
use std::thread;
Expand All @@ -22,15 +22,15 @@ use std::any::Any;

pub trait BroadcastHandle: Send {
fn send(&self, message_body: MessageBody);
as_any_dcl!();
declare_as_any!();
}

pub struct BroadcastHandleInactive;

impl BroadcastHandle for BroadcastHandleInactive {
//simply dropped (unless we find a better use for such a message)
fn send(&self, _message_body: MessageBody) {}
as_any_impl!();
implement_as_any!();
}

pub struct BroadcastHandleGeneric {
Expand Down
4 changes: 2 additions & 2 deletions masq_lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ macro_rules! intentionally_blank {
}

#[macro_export]
macro_rules! as_any_dcl {
macro_rules! declare_as_any {
() => {
#[cfg(test)]
fn as_any(&self) -> &dyn Any {
Expand All @@ -388,7 +388,7 @@ macro_rules! as_any_dcl {
}

#[macro_export]
macro_rules! as_any_impl {
macro_rules! implement_as_any {
() => {
#[cfg(test)]
fn as_any(&self) -> &dyn Any {
Expand Down
Loading

0 comments on commit 646eac2

Please sign in to comment.