Skip to content

Commit

Permalink
remove test_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
pscott committed Aug 29, 2023
1 parent e72d55f commit b36a8a9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_vanilla_works() {
vanilla_works() {
starknet::testing::set_block_timestamp(1);

// deploy vanilla voting strategy
Expand Down Expand Up @@ -107,7 +107,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_merkle_whitelist_works() {
merkle_whitelist_works() {
starknet::testing::set_block_timestamp(1);

// deploy merkle whitelist contract
Expand Down Expand Up @@ -262,7 +262,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_erc20votes_works() {
erc20votes_works() {
let SUPPLY = 100_u256;

// deploy erc20 voting strategy
Expand Down
4 changes: 2 additions & 2 deletions starknet/src/tests/test_factory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_deploy() {
deploy() {
// Deploy Space
let config = setup();

Expand All @@ -78,7 +78,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_deploy_reuse_salt() {
deploy_reuse_salt() {
let mut constructor_calldata = array![];

let (factory_address, _) = deploy_syscall(
Expand Down
16 changes: 8 additions & 8 deletions starknet/src/tests/test_space.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod tests {

#[test]
#[available_gas(100000000)]
fn test_initialize() {
initialize() {
let deployer = contract_address_const::<0xdead>();

testing::set_caller_address(deployer);
Expand Down Expand Up @@ -106,7 +106,7 @@ mod tests {
#[test]
#[available_gas(100000000)]
#[should_panic(expected: ('Already Initialized', 'ENTRYPOINT_FAILED'))]
fn test_reinitialize() {
reinitialize() {
let deployer = contract_address_const::<0xdead>();

testing::set_caller_address(deployer);
Expand Down Expand Up @@ -198,7 +198,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test__propose_update_vote_execute() {
fn propose_update_vote_execute() {
let config = setup();
let (factory, space) = deploy(@config);

Expand Down Expand Up @@ -291,7 +291,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Proposal is not valid', 'ENTRYPOINT_FAILED'))]
fn test__propose_failed_validation() {
fn propose_failed_validation() {
let config = setup();
let (factory, space) = deploy(@config);
let authenticator = IVanillaAuthenticatorDispatcher {
Expand Down Expand Up @@ -409,7 +409,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Proposal has been finalized', 'ENTRYPOINT_FAILED'))]
fn test__cancel() {
fn cancel() {
let relayer = contract_address_const::<0x1234>();
let config = setup();
let (factory, space) = deploy(@config);
Expand Down Expand Up @@ -471,7 +471,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Zero Address', 'ENTRYPOINT_FAILED'))]
fn test_propose_zero_address() {
fn propose_zero_address() {
let config = setup();
let (factory, space) = deploy(@config);

Expand Down Expand Up @@ -508,7 +508,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Zero Address', 'ENTRYPOINT_FAILED'))]
fn test_update_zero_address() {
update_zero_address() {
let config = setup();
let (factory, space) = deploy(@config);

Expand Down Expand Up @@ -562,7 +562,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Zero Address', 'ENTRYPOINT_FAILED'))]
fn test_vote_zero_address() {
vote_zero_address() {
let config = setup();
let (factory, space) = deploy(@config);

Expand Down
8 changes: 4 additions & 4 deletions starknet/src/tests/test_stark_tx_auth.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_propose_update_vote() {
propose_update_vote() {
let config = setup();
let (factory, space) = deploy(@config);
let authenticator = setup_stark_tx_auth(space, config.owner);
Expand Down Expand Up @@ -115,7 +115,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Invalid Caller', 'ENTRYPOINT_FAILED'))]
fn test_propose_invalid_caller() {
propose_invalid_caller() {
let config = setup();
let (factory, space) = deploy(@config);
let authenticator = setup_stark_tx_auth(space, config.owner);
Expand Down Expand Up @@ -147,7 +147,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Invalid Caller', 'ENTRYPOINT_FAILED'))]
fn test_update_proposal_invalid_caller() {
update_proposal_invalid_caller() {
let config = setup();
let (factory, space) = deploy(@config);
let authenticator = setup_stark_tx_auth(space, config.owner);
Expand Down Expand Up @@ -197,7 +197,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Invalid Caller', 'ENTRYPOINT_FAILED'))]
fn test_vote_invalid_caller() {
vote_invalid_caller() {
let config = setup();
let (factory, space) = deploy(@config);
let authenticator = setup_stark_tx_auth(space, config.owner);
Expand Down
6 changes: 3 additions & 3 deletions starknet/src/tests/test_upgrade.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_upgrade() {
upgrade() {
let config = setup();
let (factory, space) = deploy(@config);

Expand All @@ -58,7 +58,7 @@ mod tests {

#[test]
#[available_gas(10000000000)]
fn test_upgrade_via_execution_strategy() {
upgrade_via_execution_strategy() {
let config = setup();
let (factory, space) = deploy(@config);
let proposal_id = space.next_proposal_id();
Expand Down Expand Up @@ -116,7 +116,7 @@ mod tests {
#[test]
#[available_gas(10000000000)]
#[should_panic(expected: ('Caller is not the owner', 'ENTRYPOINT_FAILED'))]
fn test_upgrade_unauthorized() {
upgrade_unauthorized() {
let config = setup();
let (factory, space) = deploy(@config);

Expand Down
4 changes: 2 additions & 2 deletions starknet/src/tests/utils/strategy_trait.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use sx::types::Strategy;
use starknet::{ContractAddress, contract_address_const};

trait StrategyTrait {
fn test_value() -> Strategy;
value() -> Strategy;
fn from_address(addr: ContractAddress) -> Strategy;
}

impl StrategyImpl of StrategyTrait {
fn test_value() -> Strategy {
value() -> Strategy {
Strategy { address: contract_address_const::<0x5c011>(), params: array![], }
}

Expand Down
12 changes: 6 additions & 6 deletions starknet/src/types/proposal.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mod tests {
use clone::Clone;

#[test]
fn test_pack_zero() {
pack_zero() {
let proposal = Proposal {
start_timestamp: 0,
min_end_timestamp: 0,
Expand All @@ -122,7 +122,7 @@ mod tests {


#[test]
fn test_pack_start_timestamp() {
pack_start_timestamp() {
let proposal = Proposal {
start_timestamp: 42,
min_end_timestamp: 0,
Expand All @@ -141,7 +141,7 @@ mod tests {
}

#[test]
fn test_pack_min_timestamp() {
pack_min_timestamp() {
let proposal = Proposal {
start_timestamp: 0,
min_end_timestamp: 42,
Expand All @@ -161,7 +161,7 @@ mod tests {


#[test]
fn test_pack_max_timestamp() {
pack_max_timestamp() {
let proposal = Proposal {
start_timestamp: 0,
min_end_timestamp: 0,
Expand All @@ -182,7 +182,7 @@ mod tests {
}

#[test]
fn test_pack_finalization_status() {
pack_finalization_status() {
let proposal = Proposal {
start_timestamp: 0,
min_end_timestamp: 0,
Expand All @@ -204,7 +204,7 @@ mod tests {
}

#[test]
fn test_pack_full() {
pack_full() {
let proposal = Proposal {
start_timestamp: 0xffffffff,
min_end_timestamp: 0xffffffff,
Expand Down
8 changes: 4 additions & 4 deletions starknet/src/types/user_address.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ mod tests {
use starknet::{EthAddress, contract_address_const};

#[test]
fn test_is_zero() {
is_zero() {
assert(UserAddress::Starknet(contract_address_const::<0>()).is_zero(), 'is not zero');
assert(UserAddress::Ethereum(EthAddress { address: 0 }).is_zero(), 'is not zero');
assert(UserAddress::Custom(0_u256).is_zero(), 'is not zero');
}

#[test]
fn test_is_zero_false_positive() {
is_zero_false_positive() {
assert(
UserAddress::Starknet(contract_address_const::<1>()).is_zero() == false,
'false positive not zero'
Expand All @@ -104,14 +104,14 @@ mod tests {
}

#[test]
fn test_is_non_zero() {
is_non_zero() {
assert(UserAddress::Starknet(contract_address_const::<1>()).is_non_zero(), 'is zero');
assert(UserAddress::Ethereum(EthAddress { address: 1 }).is_non_zero(), 'is zero');
assert(UserAddress::Custom(1_u256).is_non_zero(), 'is zero');
}

#[test]
fn test_is_non_zero_false_positive() {
is_non_zero_false_positive() {
assert(
UserAddress::Starknet(contract_address_const::<0>()).is_non_zero() == false,
'false positive is zero'
Expand Down

0 comments on commit b36a8a9

Please sign in to comment.