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

fix: Minor logic and add unit tests for RNSUnified #6

Merged
merged 23 commits into from
Oct 10, 2023

Conversation

TuDo1403
Copy link
Collaborator

@TuDo1403 TuDo1403 commented Oct 4, 2023

Description

This PR adds unit tests for RNSUnified.

Changes

  • Add ERC721::exists check for RNSUnified::canSetRecord
  • Fix ModifyingIndicator::hasAny function.
  • Fix RNSUnified::setRecord.
  • FIx event RecordUpdated emit many times / wrong data.
  • Fix assembly error revert not work properly.

Test Coverage

Reproduce script:

forge coverage

Output

| File                                | % Lines          | % Statements     | % Branches     | % Funcs        |
|-------------------------------------|------------------|------------------|----------------|----------------|
| src/RNSToken.sol                    | 60.00% (9/15)    | 55.00% (11/20)   | 100.00% (0/0)  | 58.33% (7/12)  |
| src/RNSUnified.sol                  | 84.82% (95/112)  | 85.14% (126/148) | 85.42% (41/48) | 80.77% (21/26) |
| src/libraries/LibModifyingField.sol | 0.00% (0/1)      | 0.00% (0/2)      | 100.00% (0/0)  | 0.00% (0/1)    |
| src/libraries/math/LibSafeRange.sol | 100.00% (5/5)    | 80.00% (8/10)    | 66.67% (4/6)   | 100.00% (2/2)  |
| test/RNSUnified/RNSUnified.t.sol    | 0.00% (0/105)    | 0.00% (0/114)    | 0.00% (0/42)   | 0.00% (0/11)   |
| Total                               | 45.80% (109/238) | 49.32% (145/294) | 46.88% (45/96) | 57.69% (30/52) |

Checklist

  • I have clearly commented on all the main functions following the NatSpec Format
  • The box that allows repo maintainers to update this PR is checked
  • I tested locally to make sure this feature/fix works

@TuDo1403 TuDo1403 changed the title feat: add RNSUnified.mint tests [UnitTest]: Add RNSUnified Unit Tests Oct 4, 2023
@TuDo1403 TuDo1403 changed the title [UnitTest]: Add RNSUnified Unit Tests [Test]: Add RNSUnified Unit Tests Oct 4, 2023
@TuDo1403 TuDo1403 marked this pull request as ready for review October 7, 2023 05:20
Tu Do and others added 2 commits October 9, 2023 16:06
Co-authored-by: Duke.ron <[email protected]>
ducthotran2010
ducthotran2010 previously approved these changes Oct 9, 2023
@ducthotran2010 ducthotran2010 changed the title [Test]: Add RNSUnified Unit Tests fix: Minor logic and add unit tests for RNSUnified Oct 9, 2023
Copy link
Contributor

@ducthotran2010 ducthotran2010 left a comment

Choose a reason for hiding this comment

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

Lgtm

@TuDo1403 TuDo1403 merged commit 0999e7e into feature/rns-unified Oct 10, 2023
@ducthotran2010 ducthotran2010 deleted the test/rns-unified branch October 10, 2023 04:59
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