This quiz covers the following parts of the Substrate Knowledge Map:
A.
struct Pair(i32, f32);
B.
#[derive(Encode, Decode, Default, Clone, PartialEq)]
pub struct MyStruct {
some_number: u32,
optional_number: Option<u32>,
}
C.
#[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
let who = ensure_signed(origin)?;
<Something<T>>::put(something);
Ok(())
}
D.
struct Person {
char name[30];
int citizenship;
int age;
}
assert!(expression)
and assert_eq!(left, right)
are useful helper macros to evaluate expressions.cargo run test
.mod
with the #[cfg(test)]
attribute.