Skip to content
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

unit tests for PoolConfigLib #506

Merged
merged 7 commits into from
Apr 17, 2024
Merged

unit tests for PoolConfigLib #506

merged 7 commits into from
Apr 17, 2024

Conversation

elshan-eth
Copy link
Contributor

@elshan-eth elshan-eth commented Apr 16, 2024

Description

Added unit tests for Pool ConfigLib but the coverage result is wrong -_-

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

Issue Resolution

Closes #497, #498

@elshan-eth elshan-eth changed the title test: PoolConfigLib tests unit tests for PoolConfigLib Apr 17, 2024
Copy link
Contributor

@joaobrunoah joaobrunoah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests! Much clearer than checking bytes only

@@ -0,0 +1,801 @@
// SPDX-License-Identifier: GPL-3.0-or-later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Collaborator

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very thorough :) Some of this might be redundant/overkill, as we have very robust tests for WordCodec, which underpins all of this.

However, it is testing that the constant offsets don't step on each other (which could be missed by other tests), and that the bits "line up" with the corresponding functions.

We don't modify this too often, so I suppose it isn't too onerous to maintain. Odd that it updates snaps when all we're doing is tests. I guess they were out-of-date? Make sure it's updated from latest main and rerun to see if those go away.

The only substantive thing is the "crete" function naming; other than that, I'll never complain about adding tests :)

pkg/vault/test/foundry/unit/PoolConfigLib.t.sol Outdated Show resolved Hide resolved
@elshan-eth
Copy link
Contributor Author

Very thorough :) Some of this might be redundant/overkill, as we have very robust tests for WordCodec, which underpins all of this.

However, it is testing that the constant offsets don't step on each other (which could be missed by other tests), and that the bits "line up" with the corresponding functions.

We don't modify this too often, so I suppose it isn't too onerous to maintain. Odd that it updates snaps when all we're doing is tests. I guess they were out-of-date? Make sure it's updated from latest main and rerun to see if those go away.

The only substantive thing is the "crete" function naming; other than that, I'll never complain about adding tests :)

I wanted to check every function, offset, and that the data in the structure exactly matches the bits. Maybe it's too much😅

@elshan-eth elshan-eth merged commit 27f0453 into main Apr 17, 2024
10 checks passed
@elshan-eth elshan-eth deleted the unit-tests branch April 17, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants