Skip to content

Commit

Permalink
mdBook generated from gitorial
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Nov 4, 2024
1 parent b425085 commit 6757dbd
Show file tree
Hide file tree
Showing 79 changed files with 438 additions and 438 deletions.
16 changes: 8 additions & 8 deletions src/1/source/changes.diff
Original file line number Diff line number Diff line change
Expand Up @@ -3751,7 +3751,7 @@ index 0000000..ae8a09b
+}
diff --git a/src/tests.rs b/src/tests.rs
new file mode 100644
index 0000000..375cd3f
index 0000000..0901674
--- /dev/null
+++ b/src/tests.rs
@@ -0,0 +1,97 @@
Expand Down Expand Up @@ -3787,12 +3787,12 @@ index 0000000..375cd3f
+
+// Our blockchain tests only need 3 Pallets:
+// 1. System: Which is included with every FRAME runtime.
+// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
+// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
+// 3. PalletKitties: The pallet you are building in this tutorial!
+construct_runtime! {
+ pub struct TestRuntime {
+ System: frame_system,
+ Balances: pallet_balances,
+ PalletBalances: pallet_balances,
+ PalletKitties: pallet_kitties,
+ }
+}
Expand All @@ -3805,8 +3805,8 @@ index 0000000..375cd3f
+ type AccountData = pallet_balances::AccountData<Balance>;
+}
+
+// Normally `Balances` would have many more configurations, but you can see that we use some macro
+// magic to automatically configure most of the pallet for a "default test configuration".
+// Normally `pallet_balances` would have many more configurations, but you can see that we use some
+// macro magic to automatically configure most of the pallet for a "default test configuration".
+#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
+impl pallet_balances::Config for TestRuntime {
+ type AccountStore = System;
Expand Down Expand Up @@ -3843,12 +3843,12 @@ index 0000000..375cd3f
+
+#[test]
+fn system_and_balances_work() {
+ // This test will just sanity check that we can access `System` and `Balances`.
+ // This test will just sanity check that we can access `System` and `PalletBalances`.
+ new_test_ext().execute_with(|| {
+ // We often need to set `System` to block 1 so that we can see events.
+ System::set_block_number(1);
+ // We often need to add some balance to a user to test features which needs tokens.
+ assert_ok!(Balances::mint_into(&ALICE, 100));
+ assert_ok!(Balances::mint_into(&BOB, 100));
+ assert_ok!(PalletBalances::mint_into(&ALICE, 100));
+ assert_ok!(PalletBalances::mint_into(&BOB, 100));
+ });
+}
14 changes: 7 additions & 7 deletions src/1/source/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,12 +86,12 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}
14 changes: 7 additions & 7 deletions src/10/source/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/11/solution/solution.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ index 7d88fff..90242f6 100644
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
diff --git a/src/tests.rs b/src/tests.rs
index 8fa3dc6..e271b01 100644
index 2526de8..7713826 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -117,3 +117,17 @@ fn create_kitty_emits_event() {
Expand Down
14 changes: 7 additions & 7 deletions src/11/solution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/11/template/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/12/solution/solution.diff
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ index b396f98..9739330 100644
Ok(())
}
diff --git a/src/tests.rs b/src/tests.rs
index e271b01..08f81b9 100644
index 7713826..6de2fcc 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -131,3 +131,15 @@ fn count_for_kitties_created_correctly() {
Expand Down
14 changes: 7 additions & 7 deletions src/12/solution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/12/template/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/13/solution/solution.diff
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ index 8edcc9b..2c11f46 100644

#[pallet::call]
diff --git a/src/tests.rs b/src/tests.rs
index 08f81b9..089ada9 100644
index 6de2fcc..fd8e478 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -143,3 +143,16 @@ fn mint_increments_count_for_kitty() {
Expand Down
14 changes: 7 additions & 7 deletions src/13/solution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const BOB: u64 = 2;

// Our blockchain tests only need 3 Pallets:
// 1. System: Which is included with every FRAME runtime.
// 2. Balances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 2. PalletBalances: Which is manages your blockchain's native currency. (i.e. DOT on Polkadot)
// 3. PalletKitties: The pallet you are building in this tutorial!
construct_runtime! {
pub struct TestRuntime {
System: frame_system,
Balances: pallet_balances,
PalletBalances: pallet_balances,
PalletKitties: pallet_kitties,
}
}
Expand All @@ -48,8 +48,8 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
}

// Normally `Balances` would have many more configurations, but you can see that we use some macro
// magic to automatically configure most of the pallet for a "default test configuration".
// Normally `pallet_balances` would have many more configurations, but you can see that we use some
// macro magic to automatically configure most of the pallet for a "default test configuration".
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
Expand Down Expand Up @@ -86,13 +86,13 @@ fn starting_template_is_sane() {

#[test]
fn system_and_balances_work() {
// This test will just sanity check that we can access `System` and `Balances`.
// This test will just sanity check that we can access `System` and `PalletBalances`.
new_test_ext().execute_with(|| {
// We often need to set `System` to block 1 so that we can see events.
System::set_block_number(1);
// We often need to add some balance to a user to test features which needs tokens.
assert_ok!(Balances::mint_into(&ALICE, 100));
assert_ok!(Balances::mint_into(&BOB, 100));
assert_ok!(PalletBalances::mint_into(&ALICE, 100));
assert_ok!(PalletBalances::mint_into(&BOB, 100));
});
}

Expand Down
Loading

0 comments on commit 6757dbd

Please sign in to comment.