From e95519b7f95517780e912df1277f06f707d1176e Mon Sep 17 00:00:00 2001 From: "Franklin \"Snaipe\" Mathieu" Date: Fri, 4 Nov 2016 15:28:28 +0100 Subject: lua: Added new integer sizes in TvbRange * Added support for 3-byte integers in :int() and :le_int() * Added support for 5, 6, and 7-byte integers in :int64() and :le_int64() Change-Id: If9ab4ea806191bc63effe45a081b9c65693c2367 Signed-off-by: Franklin "Snaipe" Mathieu Reviewed-on: https://code.wireshark.org/review/18672 Reviewed-by: Peter Wu Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte --- test/lua/tvb.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'test/lua') diff --git a/test/lua/tvb.lua b/test/lua/tvb.lua index 6b63ff447a..1eb576c973 100644 --- a/test/lua/tvb.lua +++ b/test/lua/tvb.lua @@ -54,7 +54,7 @@ end -- number of verifyFields() * (1 + number of fields) + -- number of verifyResults() * (1 + 2 * number of values) -- -local taptests = { [FRAME]=4, [OTHER]=318 } +local taptests = { [FRAME]=4, [OTHER]=330 } local function getResults() print("\n-----------------------------\n") @@ -149,6 +149,7 @@ local testfield = STRING = ProtoField.string ("test.basic.string", "Basic string"), BOOLEAN = ProtoField.bool ("test.basic.boolean", "Basic boolean", 16, {"yes","no"}, 0x0001), UINT16 = ProtoField.uint16 ("test.basic.uint16", "Basic uint16"), + INT24 = ProtoField.int24 ("test.basic.uint24", "Basic uint24"), BYTES = ProtoField.bytes ("test.basic.bytes", "Basic Bytes"), UINT_BYTES = ProtoField.ubytes ("test.basic.ubytes", "Basic Uint Bytes"), OID = ProtoField.oid ("test.basic.oid", "Basic OID"), @@ -197,6 +198,7 @@ local getfield = STRING = Field.new ("test.basic.string"), BOOLEAN = Field.new ("test.basic.boolean"), UINT16 = Field.new ("test.basic.uint16"), + INT24 = Field.new ("test.basic.uint24"), BYTES = Field.new ("test.basic.bytes"), UINT_BYTES = Field.new ("test.basic.ubytes"), OID = Field.new ("test.basic.oid"), @@ -426,6 +428,30 @@ function test_proto.dissector(tvbuf,pktinfo,root) verifyFields("basic.UINT16", uint16_match_fields) +---------------------------------------- + testing(OTHER, "Basic int24") + + local int24_match_fields = {} + + execute ("basic-int24", pcall (callTreeAdd, tree, testfield.basic.INT24, tvb_bytes:range(0,3)) ) + addMatchFields(int24_match_fields, 65280) + + execute ("basic-int24", pcall (callTreeAdd, tree, testfield.basic.INT24, tvb_bytes:range(3,3)) ) + addMatchFields(int24_match_fields, 98304) + + verifyFields("basic.INT24", int24_match_fields) + +---------------------------------------- + testing(OTHER, "Basic int24-le") + + execute ("basic-int24", pcall (callTreeAddLE, tree, testfield.basic.INT24, tvb_bytes:range(0,3)) ) + addMatchFields(int24_match_fields, 65280) + + execute ("basic-int24", pcall (callTreeAddLE, tree, testfield.basic.INT24, tvb_bytes:range(3,3)) ) + addMatchFields(int24_match_fields, 32769) + + verifyFields("basic.INT24", int24_match_fields) + ---------------------------------------- testing(OTHER, "Basic bytes") -- cgit v1.2.3