Skip to content

Commit

Permalink
Shorten the errors tests (stellar#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Oct 8, 2022
1 parent 6cc2f11 commit 936973f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 2 additions & 2 deletions errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pub enum Error {
}

const COUNTER: Symbol = symbol!("COUNTER");
const MAX: u32 = 10;
const MAX: u32 = 5;

pub struct IncrementContract;

#[contractimpl]
impl IncrementContract {
/// Increment increments an internal counter, and returns the value. Errors
/// if the value is attempted to be incremented past 10.
/// if the value is attempted to be incremented past 5.
pub fn increment(env: Env) -> Result<u32, Error> {
// Get the current count.
let mut count: u32 = env
Expand Down
10 changes: 0 additions & 10 deletions errors/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ fn test() {
assert_eq!(client.try_increment(), Ok(Ok(3)));
assert_eq!(client.try_increment(), Ok(Ok(4)));
assert_eq!(client.try_increment(), Ok(Ok(5)));
assert_eq!(client.try_increment(), Ok(Ok(6)));
assert_eq!(client.try_increment(), Ok(Ok(7)));
assert_eq!(client.try_increment(), Ok(Ok(8)));
assert_eq!(client.try_increment(), Ok(Ok(9)));
assert_eq!(client.try_increment(), Ok(Ok(10)));
assert_eq!(client.try_increment(), Err(Ok(Error::LimitReached)));

std::println!("{}", env.logger().all().join("\n"));
Expand All @@ -38,10 +33,5 @@ fn test_panic() {
assert_eq!(client.increment(), 3);
assert_eq!(client.increment(), 4);
assert_eq!(client.increment(), 5);
assert_eq!(client.increment(), 6);
assert_eq!(client.increment(), 7);
assert_eq!(client.increment(), 8);
assert_eq!(client.increment(), 9);
assert_eq!(client.increment(), 10);
client.increment();
}

0 comments on commit 936973f

Please sign in to comment.