diff options
author | Richard Sharpe <realrichardsharpe@gmail.com> | 2018-10-14 12:14:13 -0700 |
---|---|---|
committer | Richard Sharpe <realrichardsharpe@gmail.com> | 2018-10-17 20:08:57 +0000 |
commit | 6eba988f7cf739f2f9055dfedcc94eba5d3246a9 (patch) | |
tree | 077b0fe6ec530fffef7e76d93cada0f11eb66ee2 /test | |
parent | c826e2a77e21a6f010073956bc0103997584b881 (diff) |
wslua: Add support for base.RANGE_STRING handling.
A range string is passed as a table of tables, eg:
range_string = {
{ 0, 24, "Some string for values 0 to 24" },
{ 25, 25, "The string for value 25" },
{ 26, 255, "The string for the remainder" }
}
Included is a minimal Lua test for range strings and value strings
(which did not have one previously.) It will take more time than I
currently have to figure out how to do a more exhaustive test.
Also fixed some grammar issues in error messages along the way.
Change-Id: Ia9d1efc8adabb6528c4bdcf1624c9ede49e2fdc6
Reviewed-on: https://code.wireshark.org/review/30211
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/tvb.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/lua/tvb.lua b/test/lua/tvb.lua index e03a7b61b4..43a042ee85 100644 --- a/test/lua/tvb.lua +++ b/test/lua/tvb.lua @@ -142,13 +142,21 @@ end ---------------------------------------- -- a table of all of our Protocol's fields +range_string = { + { 0, 200, "The first part" }, + { 201, 233, "The second part" }, + { 234, 255, "The last part" }, +} + local testfield = { basic = { STRING = ProtoField.string ("test.basic.string", "Basic string"), BOOLEAN = ProtoField.bool ("test.basic.boolean", "Basic boolean", 16, {"yes","no"}, 0x0001), + UINT8 = ProtoField.uint8 ("test.basic.uint8", "Basic uint8 with range string", base.RANGE_STRING, range_string ), UINT16 = ProtoField.uint16 ("test.basic.uint16", "Basic uint16"), + UINT32 = ProtoField.uint32 ("test.basic.uint32", "Basic uint32 test with a unit string", base.UINT_STRING, { "femtoFarads" }), 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"), @@ -197,6 +205,7 @@ local getfield = { STRING = Field.new ("test.basic.string"), BOOLEAN = Field.new ("test.basic.boolean"), + UINT8 = Field.new ("test.basic.uint8"), UINT16 = Field.new ("test.basic.uint16"), INT24 = Field.new ("test.basic.uint24"), BYTES = Field.new ("test.basic.bytes"), |