-
Notifications
You must be signed in to change notification settings - Fork 1
/
MockERC20Upgradeable.t.sol
65 lines (46 loc) · 1.96 KB
/
MockERC20Upgradeable.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
/**
* @title MockERC20Upgradeable - Test
*/
import { Helper } from './shared/helper.sol';
import { MockERC20Upgradeable } from './mock/MockERC20Upgradeable.sol';
contract MockERC20UpgradeableTest is Helper {
uint8 LOG_LEVEL = 0;
MockERC20Upgradeable private mockERC20Upgradeable;
string constant _TEST_NAME = 'MockERC20Upgradeable';
string constant _TEST_SYMBOL = 'MOCK';
function setUp() public virtual {
_initialize_helper(LOG_LEVEL);
// Deploy contracts
mockERC20Upgradeable = new MockERC20Upgradeable();
mockERC20Upgradeable.initialize(_TEST_NAME, _TEST_SYMBOL);
}
function test_MockERC20Upgradeable_name() public virtual {
assertEq(mockERC20Upgradeable.name(), _TEST_NAME);
}
function test_MockERC20Upgradeable_symbol() public virtual {
assertEq(mockERC20Upgradeable.symbol(), _TEST_SYMBOL);
}
function test_MockERC20Upgradeable_mint(address to_, uint256 amount_) public virtual {
vm.assume(to_ != address(0));
vm.assume(amount_ > 0);
assertEq(mockERC20Upgradeable.balanceOf(to_), 0);
assertEq(mockERC20Upgradeable.totalSupply(), 0);
mockERC20Upgradeable.mint(to_, amount_);
assertEq(mockERC20Upgradeable.balanceOf(to_), amount_);
assertEq(mockERC20Upgradeable.totalSupply(), amount_);
}
function test_MockERC20Upgradeable_burn(address to_, uint256 amount_) public virtual {
vm.assume(to_ != address(0));
vm.assume(amount_ > 0);
assertEq(mockERC20Upgradeable.balanceOf(to_), 0);
assertEq(mockERC20Upgradeable.totalSupply(), 0);
mockERC20Upgradeable.mint(to_, amount_);
assertEq(mockERC20Upgradeable.balanceOf(to_), amount_);
vm.prank(to_);
mockERC20Upgradeable.burn(amount_);
assertEq(mockERC20Upgradeable.balanceOf(to_), 0);
assertEq(mockERC20Upgradeable.totalSupply(), 0);
}
}