@@ -8,16 +8,25 @@ contract Assignment7Test is Test {
8
8
Assignment7 assignment;
9
9
10
10
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 " );
13
13
}
14
14
15
15
function testMintAndTransfer () public {
16
- // Mint tokens to the test contract
16
+ // Mint 1000 tokens (with 18 decimals) to this test contract
17
17
assignment.mint (address (this ), 1000 * 10 ** 18 );
18
18
19
- // Check balance of the test contract
19
+ // Check the balance of the test contract
20
20
uint256 balance = assignment.balanceOf (address (this ));
21
21
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 " );
22
30
}
23
31
}
32
+
0 commit comments