Add test case for u128 panic (#5601)

* u128 panic

* Add test case for u128 memory out of bounds error

* Fix check
This commit is contained in:
Justin Starry 2019-08-26 16:31:06 -04:00 committed by GitHub
parent b4935ff4ed
commit bd20c5e791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,12 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
z -= 1;
assert_eq!(z, 340_282_366_920_938_463_463_374_607_431_768_211_454);
// ISSUE: https://github.com/solana-labs/solana/issues/5600
// assert_eq!(u128::from(1u32.to_be()), 1);
// ISSUE: https://github.com/solana-labs/solana/issues/5619
// solana_bpf_rust_128bit_dep::two_thirds(10);
let x = u64::max_value();
assert_eq!(u128::from(x) + u128::from(x), 36_893_488_147_419_103_230);

View File

@ -8,6 +8,10 @@ pub fn work(x: u128, y: u128) -> u128 {
x + y
}
pub fn two_thirds(x: u128) -> u128 {
2 * x / 3
}
#[cfg(test)]
mod test {
extern crate std;