Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 58 lines (38 sloc) 0.871 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#! /usr/bin/lua
-- Copyright (C) 2009, Parrot Fondation.

--[[

=head1 bitwise operations library

=head2 Synopsis

% prove t/bit.t

=head2 Description

Tests bit

=cut

]]

require 'Test.More'

plan(9)

if not require_ok 'bit' then
    skip_rest "no lib"
    os.exit()
end

is( bit.tobit(1), 1, "bit.tobit" )

is( bit.band(1), 1, "bit.band" )

is( bit.bxor(1, 2), 3, "bit.bxor" )

is( bit.bor(1,2,4,8,16,32,64,128), 255, "bit.bor" )

is( bit.bswap(0x12345678), 0x78563412, "bit.bswap" )
is( bit.bswap(0x9ABCDEF0), 0xF0DEBC9A)

local r, msg = pcall(dofile, 't/bit/bittest.lua')
ok( r, "bittest" )
if not r then
    diag(msg)
end

local r, msg = pcall(dofile, 't/bit/nsievebits.lua')
ok( r, "nsievebits" )
if not r then
    diag(msg)
end

-- Local Variables:
-- mode: lua
-- lua-indent-level: 4
-- fill-column: 100
-- End:
-- vim: ft=lua expandtab shiftwidth=4:
Something went wrong with that request. Please try again.