Mercurial > prosody-hg
view spec/util_bitcompat_spec.lua @ 14182:a331cde41c85 13.0
util.poll: Reject fd == FD_SETSIZE
FD_SETSIZE is the maximum total number of FDs supports (well, the highest
valid fd number). 0 is a valid fd number, so it supports up to 1023 if
FD_SETSIZE is 1024.
This is just a fencepost issue, fds > FD_SETSIZE were already correctly
rejected.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 May 2026 16:06:19 +0100 |
| parents | 9912baa541c0 |
| children |
line wrap: on
line source
describe("util.bitcompat", function () -- bitcompat will pass through to an appropriate implementation. Our -- goal here is to check that whatever implementation is in use passes -- these basic sanity checks. local bit = require "util.bitcompat"; it("bor works", function () assert.equal(0xF0FF, bit.bor(0xF000, 0x00F0, 0x000F)); end); it("band works", function () assert.equal(0x0F, bit.band(0xFF, 0x1F, 0x0F)); end); it("bxor works", function () assert.equal(0x13, bit.bxor(0x10, 0x0F, 0x0C)); end); it("rshift works", function () assert.equal(0x0F, bit.rshift(0xFF, 4)); end); it("lshift works", function () assert.equal(0xFF00, bit.lshift(0xFF, 8)); end); it("bnot works", function () assert.equal(0x0000FF00, bit.band(0xFFFFFFFF, bit.bnot(0xFFFF00FF))); end); end);
