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:
parent
b4935ff4ed
commit
bd20c5e791
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue