mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add conformance tests for bit32.byteswap
This commit is contained in:
parent
99a5140ac5
commit
cacbd31694
1 changed files with 6 additions and 0 deletions
|
@ -134,6 +134,11 @@ assert(bit32.countrz(0x80000000) == 31)
|
||||||
assert(bit32.countrz(0x40000000) == 30)
|
assert(bit32.countrz(0x40000000) == 30)
|
||||||
assert(bit32.countrz(0x7fffffff) == 0)
|
assert(bit32.countrz(0x7fffffff) == 0)
|
||||||
|
|
||||||
|
-- testing byteswap
|
||||||
|
assert(bit32.byteswap(0x10203040) == 0x40302010)
|
||||||
|
assert(bit32.byteswap(0) == 0)
|
||||||
|
assert(bit32.byteswap(0xffffffff) == 0xffffffff)
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
This test verifies a fix in luauF_replace() where if the 4th
|
This test verifies a fix in luauF_replace() where if the 4th
|
||||||
parameter was not a number, but the first three are numbers, it will
|
parameter was not a number, but the first three are numbers, it will
|
||||||
|
@ -164,5 +169,6 @@ assert(bit32.btest("1", 3) == true)
|
||||||
assert(bit32.countlz("42") == 26)
|
assert(bit32.countlz("42") == 26)
|
||||||
assert(bit32.countrz("42") == 1)
|
assert(bit32.countrz("42") == 1)
|
||||||
assert(bit32.extract("42", 1, 3) == 5)
|
assert(bit32.extract("42", 1, 3) == 5)
|
||||||
|
assert(bit32.byteswap("0xa1b2c3d4") == 0xd4c3d2a1)
|
||||||
|
|
||||||
return('OK')
|
return('OK')
|
||||||
|
|
Loading…
Add table
Reference in a new issue