Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Nov 16, 2023
1 parent dc505f8 commit f86e013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions rust/candid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@
//! # fn f() -> Result<(), candid::Error> {
//! use candid::{Int, Nat, Encode, Decode};
//! let x = "-10000000000000000000".parse::<Int>()?;
//! let bytes = Encode!(&Nat::from(1024), &x)?;
//! let bytes = Encode!(&Nat::from(1024u32), &x)?;
//! let (a, b) = Decode!(&bytes, Nat, Int)?;
//! let (c, d) = Decode!(&bytes, u128, i128)?;
//! assert_eq!(a + 1, 1025);
//! assert_eq!(a + 1u8, 1025u32);
//! assert_eq!(b, Int::parse(b"-10000000000000000000")?);
//! # Ok(())
//! # }
Expand Down
6 changes: 3 additions & 3 deletions rust/candid/tests/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ fn test_bool() {
#[test]
fn test_integer() {
all_check(Int::from(42), "4449444c00017c2a");
all_check(Nat::from(42), "4449444c00017d2a");
all_check(Nat::from(42u16), "4449444c00017d2a");
all_check(Int::from(1_234_567_890), "4449444c00017cd285d8cc04");
all_check(Nat::from(1_234_567_890), "4449444c00017dd285d8cc04");
all_check(Nat::from(1_234_567_890u64), "4449444c00017dd285d8cc04");
all_check(Nat::from(5_000_000_000u64), "4449444c00017d80e497d012");
all_check(Int::from(-1_234_567_890), "4449444c00017caefaa7b37b");
all_check(Box::new(Int::from(42)), "4449444c00017c2a");
Expand Down Expand Up @@ -616,7 +616,7 @@ fn test_variant() {
test_decode(&bytes, &Some(Unit::Foo));
let bytes = encode(&E::Baz {
a: 42.into(),
b: 42.into(),
b: 42u8.into(),
});
test_decode(&bytes, &None::<Unit>);
let bytes = encode(&E::Bar(true, 42.into()));
Expand Down

0 comments on commit f86e013

Please sign in to comment.