1plugin = 2{ 3 type = "piglet", 4 name = "piglet::daq_header", 5 test = function() 6 dofile(SCRIPT_DIR .. "/../common.lua") 7 return run_tests(tests) 8 end 9} 10 11DEFAULT_VALUES = 12{ 13 caplen = 0, 14 pktlen = 0, 15 ingress_index = 0, 16 egress_index = 0, 17 ingress_group = 0, 18 egress_group = 0, 19 flags = 0, 20 opaque = 0, 21 flow_id = 0, 22 address_space_id = 0 23} 24 25VALUES = 26{ 27 caplen = 1, 28 pktlen = 2, 29 ingress_index = 3, 30 egress_index = 4, 31 ingress_group = 5, 32 egress_group = 6, 33 flags = 7, 34 opaque = 8, 35 flow_id = 9, 36 address_space_id = 10 37} 38 39tests = 40{ 41 initialize_default = function() 42 local daq = DAQHeader.new() 43 assert(daq) 44 check.tables_equal(DEFAULT_VALUES, daq:get()) 45 end, 46 47 initialize_with_table = function() 48 local daq = DAQHeader.new(VALUES) 49 check.tables_equal(VALUES, daq:get()) 50 end 51} 52