Skip to content

Conversation

@pro100andrey
Copy link
Owner

This pull request introduces a major update focused on documentation improvements, enhanced test coverage, and minor API usage clarifications. The most significant changes include a comprehensive rewrite of the documentation, substantial expansion of the test suite, and simplification of usage examples. Additionally, the verbose BinaryReaderInterface interface has been removed, streamlining the codebase.

Documentation and Examples:

  • Overhauled all documentation: Added detailed API docs, usage examples, inline algorithm explanations, best practices, and a migration guide. The README was rewritten for clarity and real-world usability. [1] [2]
  • Updated code examples in example/main.dart to use the new, shorter .little syntax for specifying endianness, improving code clarity. [1] [2]

Testing:

  • Expanded the test suite with 23 new comprehensive tests, specifically targeting writeVarString(), getUtf8Length(), and readVarString(), as well as edge cases for UTF-8, VarInt, and error handling.

Codebase Simplification:

  • Removed the verbose BinaryReaderInterface abstract class and its extensive inline documentation, reducing boilerplate and centralizing documentation in the README and API docs.

These changes make the library easier to use, better documented, and more robustly tested.

- Introduced a new `FastBinaryWriterBenchmark` class to evaluate performance of the FastBinaryWriter.
- Added extensive test cases for writing and reading various data types, including Uint16, Int16, Uint32, Int32, Uint64, Int64, Float32, and Float64, ensuring little-endian format is consistently used.
- Updated existing tests to utilize FastBinaryWriter instead of BinaryWriter for improved performance.
- Enhanced string writing tests with longer strings containing emojis and complex characters to stress UTF-8 encoding logic.
- Ensured all tests validate the expected byte lengths and reset conditions after taking bytes.
…naryReader

- Added `writeVarBytes` and `readVarBytes` methods for handling length-prefixed byte arrays.
- Introduced `writeVarString` and `readVarString` methods for length-prefixed UTF-8 encoded strings.
- Implemented `getUtf8Length` function to calculate the UTF-8 byte length of strings without encoding.
- Enhanced performance tests for BinaryReader and BinaryWriter to include benchmarks for new methods.
- Updated existing tests to cover new functionality and ensure correctness.
- Bumped version to 3.0.0 to reflect breaking changes and new features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants