equal
deleted
inserted
replaced
|
1 describe("util.bitcompat", function () |
|
2 -- bitcompat will pass through to an appropriate implementation. Our |
|
3 -- goal here is to check that whatever implementation is in use passes |
|
4 -- these basic sanity checks. |
|
5 |
|
6 local bit = require "util.bitcompat"; |
|
7 |
|
8 it("bor works", function () |
|
9 assert.equal(0xF0FF, bit.bor(0xF000, 0x00F0, 0x000F)); |
|
10 end); |
|
11 |
|
12 it("band works", function () |
|
13 assert.equal(0x0F, bit.band(0xFF, 0x1F, 0x0F)); |
|
14 end); |
|
15 |
|
16 it("bxor works", function () |
|
17 assert.equal(0x13, bit.bxor(0x10, 0x0F, 0x0C)); |
|
18 end); |
|
19 |
|
20 it("rshift works", function () |
|
21 assert.equal(0x0F, bit.rshift(0xFF, 4)); |
|
22 end); |
|
23 |
|
24 it("lshift works", function () |
|
25 assert.equal(0xFF00, bit.lshift(0xFF, 8)); |
|
26 end); |
|
27 end); |