Skip to content

Add tests for serialization functions in io package #1468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GarmashAlex
Copy link

@GarmashAlex GarmashAlex commented Apr 5, 2025

Description

This PR adds tests for the basic serialization functions in the io package,
specifically WriteBytesShort and ReadBytesShort. These functions are critical
for the correct serialization and deserialization of data in gnark.

The added tests cover:

  • Round-trip serialization with different data sizes
  • Edge cases (empty data, maximum length data)
  • Error handling (data too long, failing reader)
  • Behavior with incomplete data

Previously, the io package had no tests ([no test files]), and this PR helps
improve test coverage for this critical functionality.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • ran test and saw there was no test file for github.com/consensys/gnark/io
  • ran tests for whole project. now - ok github.com/consensys/gnark/io 0.524s
    All tests pass

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@GarmashAlex GarmashAlex deleted the hpp40 branch April 18, 2025 17:12
@GarmashAlex GarmashAlex restored the hpp40 branch April 18, 2025 17:29
@GarmashAlex GarmashAlex reopened this Apr 18, 2025
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.

1 participant