Skip to content

Commit

Permalink
Create unit_tests.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 7, 2024
1 parent 5a96bc1 commit b7fdad6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/stablecoin/tests/unit_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// tests/unit_tests.rs
#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_collateralization() {
let mut collateralization = Collateralization::new();
collateralization.add_collateral(500.0);
assert!(collateralization.check_collateralization());
}

#[test]
fn test_multi_sig_wallet() {
let owners: HashSet<String> = ["owner1".to_string(), "owner2".to_string()].iter().cloned().collect();
let wallet = MultiSigWallet::new(owners, 2);
let mut signatures: HashSet<String> = HashSet::new();
signatures.insert("owner1".to_string());
signatures.insert("owner2".to_string());
assert!(wallet.execute_transaction("Transfer 100 Pi Coins", &signatures));
}
}

0 comments on commit b7fdad6

Please sign in to comment.