string_input.rs 512 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use ink_lang as ink;
use ink_lang_ir as ir;

macro_rules! assert_macro_eq {
    ( $input:literal ) => {{
        // We put it into a constant to verify that the computation is constant.
        const HASH: u32 = ink::selector_id!($input);
        assert_eq!(
            HASH,
            ir::Selector::new($input.as_bytes()).into_be_u32(),
        );
    }};
}

fn main() {
    assert_macro_eq!("");
    assert_macro_eq!("Hello, World!");
    assert_macro_eq!("message");
    assert_macro_eq!("constructor");
}