NBT icon indicating copy to clipboard operation
NBT copied to clipboard

Write unit tests

Open dktapps opened this issue 7 years ago • 1 comments

incomplete list of things that should be tested:

  • CompoundTag/ListTag API
    • [x] iterating in foreach
    • [ ] getValue()
    • [ ] getters and setters
    • [ ] array-access API (yuck)
    • [ ] count()ing tags (even things as simple as that can be botched, see https://github.com/pmmp/PocketMine-NBT/commit/da884fe4a70613f42c69c884bf8f30e9a272b04f)
    • [x] tag[] = value syntax should not be allowed (CompoundTags are effectively maps)
  • ListTag-only API
    • [ ] push(), pop(), etc (once #33 is done)
    • [x] automatic detection of tag type when list is of type TAG_End
    • [x] assigning wrong tag type to list that is not of type TAG_End (should throw exception)
    • [x] setting tag type manually (should only be allowed when list is empty)
    • [x] appending tags using list[] = tag syntax
    • [x] type checking for adding new tags to lists
    • [x] list[] = primitiveValue should throw exceptions
  • General NamedTag API
    • [x] bounds checking for byte/short/int/long
    • [ ] setName()/getName()
    • [ ] creating tags with and without preset values

This does not currently cover any of the streams API (TODO).

dktapps avatar Feb 06 '18 11:02 dktapps

There are currently no unit tests which test serialize API, which is a problem because this is quite a mission critical component

dktapps avatar Jan 08 '19 13:01 dktapps