mirror of
https://github.com/deavmi/doap
synced 2024-07-04 15:30:09 +02:00
CoapPacket
- `getBytes()` now encodes the token Packet (unit tests) - Check the encoding of the token
This commit is contained in:
parent
0e450556be
commit
8c30637c1f
|
@ -55,6 +55,12 @@ public class CoapPacket
|
|||
encoded ~= [hiByte, lowByte];
|
||||
}
|
||||
|
||||
// Set the token (if any)
|
||||
if(tokenLen)
|
||||
{
|
||||
encoded ~= token;
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
@ -169,4 +175,9 @@ unittest
|
|||
assert(thirdByte == 1);
|
||||
assert(fourthByte == 1);
|
||||
|
||||
// Ensure the token is [0, 69]
|
||||
ubyte fifthByte = encoded[4], sixthByte = encoded[5];
|
||||
assert(fifthByte == 0);
|
||||
assert(sixthByte == 69);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user