ext-encoding icon indicating copy to clipboard operation
ext-encoding copied to clipboard

Unit tests

Open dktapps opened this issue 3 years ago • 0 comments

The following things should be tested:

  • [x] Basic parity with appropriate pack() and unpack() codes with selected values
  • [ ] Symmetry of encoding and decoding
  • [x] read*() must correctly handle non-reference types by throwing an error
  • [x] read*() must correctly update reference integer offset parameter if given
  • [x] read*() must correctly handle not being given an offset parameter
  • [x] read*() must read from the correct place when given an offset parameter
  • [x] writeUnsignedVarInt() must handle negative numbers properly (i.e. it must terminate)
  • [x] readUnsignedVarInt() must limit the number of bytes read and error appropriately
  • [x] read*() functions must error properly when not given enough bytes
  • [x] clone must work correctly on ByteBuffer
  • [x] serialize and unserialize must work correctly on ByteBuffer
  • [x] $buffer = new ByteBuffer($data) should behave the same as $buffer = new ByteBuffer(); $buffer->writeByteArray($data);

to be continued ...

dktapps avatar Jan 24 '22 15:01 dktapps