Skip to content

Commit

Permalink
check script passes
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Sep 13, 2024
1 parent 89d9542 commit 44b7e83
Show file tree
Hide file tree
Showing 35 changed files with 85 additions and 82 deletions.
4 changes: 2 additions & 2 deletions steps/21/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}
4 changes: 2 additions & 2 deletions steps/22/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}
4 changes: 2 additions & 2 deletions steps/23/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/24/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/25/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/26/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/27/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/28/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/29/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, ());
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/30/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/31/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
5 changes: 2 additions & 3 deletions steps/32/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down Expand Up @@ -194,6 +194,5 @@ fn create_kitty_makes_unique_kitties() {
// And should result in two kitties in our system.
assert_eq!(CountForKitties::<TestRuntime>::get(), 2);
assert_eq!(Kitties::<TestRuntime>::iter().count(), 2);

})
}
5 changes: 2 additions & 3 deletions steps/33/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down Expand Up @@ -194,6 +194,5 @@ fn create_kitty_makes_unique_kitties() {
// And should result in two kitties in our system.
assert_eq!(CountForKitties::<TestRuntime>::get(), 2);
assert_eq!(Kitties::<TestRuntime>::iter().count(), 2);

})
}
4 changes: 2 additions & 2 deletions steps/34/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/35/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/36/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/37/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/38/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
8 changes: 5 additions & 3 deletions steps/39/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down Expand Up @@ -234,6 +234,8 @@ fn transfer_emits_event() {
// Get the kitty id.
let kitty_id = Kitties::<TestRuntime>::iter_keys().collect::<Vec<_>>()[0];
assert_ok!(PalletKitties::transfer(RuntimeOrigin::signed(ALICE), BOB, kitty_id));
System::assert_last_event(Event::<TestRuntime>::Transferred { from: ALICE, to: BOB, kitty_id }.into());
System::assert_last_event(
Event::<TestRuntime>::Transferred { from: ALICE, to: BOB, kitty_id }.into(),
);
});
}
8 changes: 5 additions & 3 deletions steps/40/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down Expand Up @@ -234,6 +234,8 @@ fn transfer_emits_event() {
// Get the kitty id.
let kitty_id = Kitties::<TestRuntime>::iter_keys().collect::<Vec<_>>()[0];
assert_ok!(PalletKitties::transfer(RuntimeOrigin::signed(ALICE), BOB, kitty_id));
System::assert_last_event(Event::<TestRuntime>::Transferred { from: ALICE, to: BOB, kitty_id }.into());
System::assert_last_event(
Event::<TestRuntime>::Transferred { from: ALICE, to: BOB, kitty_id }.into(),
);
});
}
4 changes: 2 additions & 2 deletions steps/41/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/42/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/43/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
4 changes: 2 additions & 2 deletions steps/44/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
6 changes: 3 additions & 3 deletions steps/45/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ construct_runtime! {

const ALICE: u64 = 1;
const BOB: u64 = 2;
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1 };
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1, price: None };

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
Expand Down Expand Up @@ -143,9 +143,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
6 changes: 3 additions & 3 deletions steps/46/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ construct_runtime! {

const ALICE: u64 = 1;
const BOB: u64 = 2;
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1 };
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1, price: None };

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
Expand Down Expand Up @@ -143,9 +143,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
6 changes: 3 additions & 3 deletions steps/47/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ construct_runtime! {

const ALICE: u64 = 1;
const BOB: u64 = 2;
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1 };
const DEFAULT_KITTY: Kitty<TestRuntime> = Kitty { dna: [0u8; 32], owner: 1, price: None };

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
Expand Down Expand Up @@ -143,9 +143,9 @@ fn mint_errors_when_overflow() {
fn kitties_map_created_correctly() {
new_test_ext().execute_with(|| {
let zero_key = [0u8; 32];
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), false);
assert!(!Kitties::<TestRuntime>::contains_key(zero_key));
Kitties::<TestRuntime>::insert(zero_key, DEFAULT_KITTY);
assert_eq!(Kitties::<TestRuntime>::contains_key(zero_key), true);
assert!(Kitties::<TestRuntime>::contains_key(zero_key));
})
}

Expand Down
Loading

0 comments on commit 44b7e83

Please sign in to comment.