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

test: unit tests for BFactory.sol #2

Merged
merged 9 commits into from
May 3, 2024
Merged

Conversation

0xAustrian
Copy link

No description provided.

@0xAustrian 0xAustrian self-assigned this May 2, 2024
@0xAustrian 0xAustrian changed the title test: basic test structure, bump solc version test: unit tests for BFactory.sol May 2, 2024
@0xAustrian 0xAustrian marked this pull request as ready for review May 3, 2024 12:38
@0xAustrian 0xAustrian requested a review from wei3erHase May 3, 2024 12:39
@@ -127,7 +127,7 @@ contract TToken {
function transferFrom(address src, address dst, uint amt) external returns (bool) {
require(msg.sender == src || amt <= _allowance[src][msg.sender], "ERR_BTOKEN_BAD_CALLER");
_move(src, dst, amt);
if (msg.sender != src && _allowance[src][msg.sender] != uint256(-1)) {
if (msg.sender != src && _allowance[src][msg.sender] != uint256(int(-1))) {
Copy link
Member

Choose a reason for hiding this comment

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

use type(uint256).max instead 🙏

Copy link
Member

@wei3erHase wei3erHase left a comment

Choose a reason for hiding this comment

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

looking good!

Copy link
Member

Choose a reason for hiding this comment

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

i think this is sth that may improve on the way forward, but we could have standarized names for testing, such as:
test_Set_Owner
test_Set_IsBPool
test_Emit_Logs
test_Returns_Pool
and so, in that way, we can then filter them out for example to be run individually, or by topic

* @notice Test that a valid pool is present on the mapping
*/
function test_validPoolIsBPool() public {
BPool _pool = bFactory.newBPool();
Copy link
Member

Choose a reason for hiding this comment

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

can we avoid deploying a new pool but instead overwriting the storage with cheatcodes? 🙏

Copy link
Member

@wei3erHase wei3erHase left a comment

Choose a reason for hiding this comment

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

LGTM! good job! 💪

@0xAustrian 0xAustrian merged commit c4bf7d6 into dev May 3, 2024
2 of 4 checks passed
@wei3erHase wei3erHase deleted the test/bfactory-unit-tests branch May 3, 2024 17:29
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