CoapPacket

- Made `OptionLenType` public

CoapPacket (unittest)

- Added unit tests for new static method added
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-29 10:06:23 +02:00
parent 2f68cc45eb
commit f3522d780d
1 changed files with 11 additions and 0 deletions

View File

@ -719,6 +719,17 @@ version(unittest)
import std.stdio;
}
/**
* Tests `CoapPacket`'s `determineLenType(size_t)'
*/
unittest
{
assert(CoapPacket.determineLenType(12) == CoapPacket.OptionLenType.ZERO_TO_TWELVE);
assert(CoapPacket.determineLenType(268) == CoapPacket.OptionLenType._8BIT_EXTENDED);
assert(CoapPacket.determineLenType(65804) == CoapPacket.OptionLenType._12_BIT_EXTENDED);
assert(CoapPacket.determineLenType(65804+1) == CoapPacket.OptionLenType.UPPER_PAYLOAD_MARKER);
}
/**
* Encoding tests
*