Skip to content

Commit

Permalink
Clean remediated test-case imports and move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcrosta committed Dec 1, 2023
1 parent 2be0e23 commit ffbf75f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ lto = true

[profile.release-with-logs]
inherits = "release"
debug-assertions = true
debug-assertions = true
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]

use soroban_sdk::{contract, contracterror, contractimpl, symbol_short, vec, Env, Symbol, Vec};
use soroban_sdk::{contract, contracterror, contractimpl, Env};

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
Expand All @@ -25,4 +25,30 @@ impl Contract {
}

#[cfg(test)]
mod test;
mod test {
use soroban_sdk::Env;

use crate::{Contract, ContractClient};

#[test]
fn random_value_sequence() {
// Given
let env = Env::default();
let contract_id = env.register_contract(None, Contract);
let client = ContractClient::new(&env, &contract_id);

// When
let first_random_value = client.generate_random_value(&10);
let second_random_value = client.generate_random_value(&10);
let third_random_value = client.generate_random_value(&10);
let fourth_random_value = client.generate_random_value(&10);
let fifth_random_value = client.generate_random_value(&10);

// Then
assert_eq!(first_random_value, 6);
assert_eq!(second_random_value, 5);
assert_eq!(third_random_value, 8);
assert_eq!(fourth_random_value, 8);
assert_eq!(fifth_random_value, 4);
}
}

This file was deleted.

0 comments on commit ffbf75f

Please sign in to comment.