diff options
author | Franklin "Snaipe" Mathieu <snaipe@diacritic.io> | 2016-11-04 15:28:28 +0100 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-11-06 09:01:16 +0000 |
commit | e95519b7f95517780e912df1277f06f707d1176e (patch) | |
tree | 171d0ba6ab3825d6a1962a3e857ad83e2046249d /test | |
parent | f894379ea73619d6c31e5c4932d93e307741ffec (diff) |
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 <snaipe@diacritic.io>
Reviewed-on: https://code.wireshark.org/review/18672
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/tvb.lua | 28 |
1 files changed, 27 insertions, 1 deletions
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"), @@ -427,6 +429,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") local bytes_match_fields = {} |