CoapPacket (unit test)

- Added negative case for minimum packet size
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-29 09:27:09 +02:00
parent 1914f0741a
commit 4ec85231d5
1 changed files with 23 additions and 1 deletions

View File

@ -808,4 +808,26 @@ unittest
CoapPacket packet = CoapPacket.fromBytes(testingIn);
writeln(packet);
}
}
/**
* Tests the minimum size required for a packet
* (Negative case)
*/
unittest
{
ubyte[] testingIn = [];
try
{
CoapPacket packet = CoapPacket.fromBytes(testingIn);
assert(false);
}
catch(CoapException e)
{
assert(true);
}
}
// 0x41, 0x02, 0xcd, 0x47