Created
August 12, 2023 12:16
-
-
Save AbhinavXT/86c6e49ecfa8c8806a68d234ed194a45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.13; | |
import "forge-std/Test.sol"; | |
import "../src/Counter.sol"; | |
contract CounterTest is Test { | |
Counter public counter; | |
function setUp() public { | |
counter = new Counter(); | |
counter.setNumber(0); | |
} | |
function testIncrement() public { | |
counter.increment(); | |
assertEq(counter.number(), 1); | |
} | |
function testSetNumber(uint256 x) public { | |
counter.setNumber(x); | |
assertEq(counter.number(), x); | |
} | |
function testMyNumber() public { | |
assertEq(counter.myNumber(), 42); | |
} | |
function testDecrement() public { | |
counter.decrement(); | |
assertEq(counter.myNumber(), 41); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment