Skip to content

Commit 83805ec

Browse files
update47
1 parent 3ba2f78 commit 83805ec

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/Assignment7.t.sol

+13-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,25 @@ contract Assignment7Test is Test {
88
Assignment7 assignment;
99

1010
function setUp() public {
11-
// pass your token name and symbol here
12-
assignment = new Assignment7();
11+
// Pass your token name and symbol here during contract creation
12+
assignment = new Assignment7("Test Token", "TST");
1313
}
1414

1515
function testMintAndTransfer() public {
16-
// Mint tokens to the test contract
16+
// Mint 1000 tokens (with 18 decimals) to this test contract
1717
assignment.mint(address(this), 1000 * 10**18);
1818

19-
// Check balance of the test contract
19+
// Check the balance of the test contract
2020
uint256 balance = assignment.balanceOf(address(this));
2121
assertEq(balance, 1000 * 10**18, "Balance should be 1000 tokens");
22+
23+
// Transfer tokens to another address and verify the balances
24+
address recipient = address(0x123);
25+
assignment.transfer(recipient, 500 * 10**18);
26+
27+
// Check balances after transfer
28+
assertEq(assignment.balanceOf(recipient), 500 * 10**18, "Recipient should have 500 tokens");
29+
assertEq(assignment.balanceOf(address(this)), 500 * 10**18, "Test contract should have 500 tokens");
2230
}
2331
}
32+

0 commit comments

Comments
 (0)