Skip to content

Commit

Permalink
Add example for u256
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz committed Mar 2, 2022
1 parent befe416 commit 90634c7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sui_programmability/examples/sources/Arithmetic.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// Show how to do arithmetic on u256
module Examples::Arithmetic {
use StarcoinFramework::U256::{Self, U256};

/// The arithmetic operation returns an incorrect output
const EWRONG_OUTPUT: u64 = 0;

const EQUAL: u8 = 0;

public fun add_u256(a: U256, b: U256): U256 {
U256::add(a, b)
}

#[test]
public fun test_add() {
// let sum = add_u256(U256::one(), U256::one());
// assert!(compare(sum, U256::from_u128(2)) == EQUAL, EWRONG_OUTPUT);
assert!(1 == 1, 0);
}
}

0 comments on commit 90634c7

Please sign in to comment.