1describe('compile', function()
2	local ffi = require('ffi')
3	local bpf = require('bpf')
4
5	it('can compile socket filter', function()
6		-- Create mock BPF map
7		local mock_map = {
8			max_entries = 16,
9			key_type = ffi.typeof('uint64_t [1]'),
10			val_type = ffi.typeof('uint64_t [1]'),
11			fd = 1,
12			__map = true,
13		}
14		-- Compile small code example
15		local code = bpf(function ()
16		   local proto = pkt.ip.proto
17		   xadd(mock_map[proto], 1)
18		end)
19		assert.truthy(code)
20		assert.same(type(code), 'table')
21		assert.same(code.pc, 15)
22	end)
23end)
24