git.delta.rocks / unique-network / refs/commits / 9121e65e7625

difftreelog

misk: add unit tests

Trubnikov Sergey2023-01-11parent: #c38b0d9.patch.diff
in: master

1 file changed

modifiedcrates/evm-coder/src/abi/test.rsdiffbeforeafterboth
539 assert_eq!(p2, 0x0b);539 assert_eq!(p2, 0x0b);
540}540}
541
542#[test]
543fn encode_decode_option_uint8_some() {
544 test_impl::<Option<u8>>(
545 0xdeadbeef,
546 Some(44),
547 &hex!(
548 "
549 deadbeef
550 0000000000000000000000000000000000000000000000000000000000000001
551 000000000000000000000000000000000000000000000000000000000000002c
552 "
553 ),
554 );
555}
556
557#[test]
558fn encode_decode_option_uint8_none() {
559 test_impl::<Option<u8>>(
560 0xdeadbeef,
561 None,
562 &hex!(
563 "
564 deadbeef
565 0000000000000000000000000000000000000000000000000000000000000000
566 0000000000000000000000000000000000000000000000000000000000000000
567 "
568 ),
569 );
570}
571
572#[test]
573fn encode_decode_option_string_some() {
574 test_impl::<Option<String>>(
575 0xdeadbeef,
576 Some("some string".to_string()),
577 &hex!(
578 "
579 deadbeef
580 0000000000000000000000000000000000000000000000000000000000000020
581 0000000000000000000000000000000000000000000000000000000000000001
582 0000000000000000000000000000000000000000000000000000000000000040
583 000000000000000000000000000000000000000000000000000000000000000b
584 736f6d6520737472696e67000000000000000000000000000000000000000000
585 "
586 ),
587 );
588}
589
590#[test]
591fn encode_decode_option_string_none() {
592 test_impl::<Option<String>>(
593 0xdeadbeef,
594 None,
595 &hex!(
596 "
597 deadbeef
598 0000000000000000000000000000000000000000000000000000000000000020
599 0000000000000000000000000000000000000000000000000000000000000000
600 0000000000000000000000000000000000000000000000000000000000000040
601 0000000000000000000000000000000000000000000000000000000000000000
602 "
603 ),
604 );
605}
541606