mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
math.unsigned: fix rsh() for uint256 too, add tests (#24865)
This commit is contained in:
parent
bb7f9f2562
commit
09e1edbd17
2 changed files with 36 additions and 10 deletions
|
@ -280,3 +280,14 @@ fn test_separators() {
|
|||
fn test_new() {
|
||||
assert unsigned.uint256_new(unsigned.uint128_max, unsigned.uint128_max) == unsigned.uint256_max
|
||||
}
|
||||
|
||||
fn test_rsh() {
|
||||
a := unsigned.uint256_from_dec_str('115792089237316195423570985008687907853269984665640564039457584007913129639935')!
|
||||
assert a.str() == a.rsh(0).str()
|
||||
assert '57896044618658097711785492504343953926634992332820282019728792003956564819967' == a.rsh(1).str()
|
||||
assert '6277101735386680763835789423207666416102355444464034512895' == a.rsh(64).str()
|
||||
assert '91343852333181432387730302044767688728495783935' == a.rsh(100).str()
|
||||
assert '340282366920938463463374607431768211455' == a.rsh(128).str()
|
||||
assert '170141183460469231731687303715884105727' == a.rsh(129).str()
|
||||
assert unsigned.uint256_zero == a.rsh(256)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue