-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test address PartialEq implementation
- Loading branch information
1 parent
323919e
commit d8c479a
Showing
3 changed files
with
118 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use multiversx_sc::types::TestAddress; | ||
use multiversx_sc_scenario::api::StaticApi; | ||
|
||
const ALICE: TestAddress = TestAddress::new("alice"); | ||
const SC_ADDR: TestAddress = TestAddress::new("sc"); | ||
|
||
#[test] | ||
fn test_address_eq() { | ||
let alice2 = TestAddress::new("alice"); | ||
|
||
assert_eq!(ALICE, alice2); | ||
assert_eq!(ALICE, alice2.to_address()); | ||
assert_eq!(ALICE.to_address(), alice2); | ||
assert_eq!(ALICE.to_address(), alice2.to_address()); | ||
|
||
assert_eq!(ALICE, alice2.to_managed_address::<StaticApi>()); | ||
assert_eq!(ALICE.to_managed_address::<StaticApi>(), alice2); | ||
assert_eq!( | ||
ALICE.to_managed_address::<StaticApi>(), | ||
alice2.to_managed_address::<StaticApi>() | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_sc_address_eq() { | ||
let sc2 = TestAddress::new("sc"); | ||
|
||
assert_eq!(SC_ADDR, sc2); | ||
assert_eq!(SC_ADDR, sc2.to_address()); | ||
assert_eq!(SC_ADDR.to_address(), sc2); | ||
assert_eq!(SC_ADDR.to_address(), sc2.to_address()); | ||
|
||
assert_eq!(SC_ADDR, sc2.to_managed_address::<StaticApi>()); | ||
assert_eq!(SC_ADDR.to_managed_address::<StaticApi>(), sc2); | ||
assert_eq!( | ||
SC_ADDR.to_managed_address::<StaticApi>(), | ||
sc2.to_managed_address::<StaticApi>() | ||
); | ||
} |