Skip to content

Commit 17be1fa

Browse files
committed
test: modernize test dependancies
1 parent d39439c commit 17be1fa

File tree

7 files changed

+18
-30
lines changed

7 files changed

+18
-30
lines changed

test-foundry/TestCommonHeapOrdering.t.sol

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.0;
33

44
import "forge-std/Test.sol";
5-
import "forge-std/Vm.sol";
65
import "forge-std/console.sol";
76

87
import "@contracts/HeapOrdering.sol";
@@ -11,8 +10,6 @@ import "./helpers/IConcreteHeapOrdering.sol";
1110
abstract contract TestCommonHeapOrdering is Test {
1211
IConcreteHeapOrdering internal heap;
1312

14-
Vm public hevm = Vm(HEVM_ADDRESS);
15-
1613
address[] public accounts;
1714
uint256 public NB_ACCOUNTS = 50;
1815
uint256 public MAX_SORTED_USERS = 50;
@@ -65,7 +62,7 @@ abstract contract TestCommonHeapOrdering is Test {
6562
}
6663

6764
function testShouldNotInsertZeroAddress() public {
68-
hevm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
65+
vm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
6966
update(address(0), 0, 10);
7067
}
7168

@@ -340,12 +337,12 @@ abstract contract TestCommonHeapOrdering is Test {
340337
}
341338

342339
function testOverflowNewValue() public {
343-
hevm.expectRevert("SafeCast: value doesn't fit in 96 bits");
340+
vm.expectRevert("SafeCast: value doesn't fit in 96 bits");
344341
update(accounts[0], 0, uint256(type(uint128).max));
345342
}
346343

347344
function testOverflowFormerValue() public {
348-
hevm.expectRevert("SafeCast: value doesn't fit in 96 bits");
345+
vm.expectRevert("SafeCast: value doesn't fit in 96 bits");
349346
update(accounts[0], uint256(type(uint128).max), 0);
350347
}
351348
}

test-foundry/TestDoubleLinkedList.t.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import "@contracts/DoubleLinkedList.sol";
77
contract TestDoubleLinkedList is Test {
88
using DoubleLinkedList for DoubleLinkedList.List;
99

10-
Vm public hevm = Vm(HEVM_ADDRESS);
11-
1210
uint256 public NDS = 50;
1311
address[] public accounts;
1412
address public ADDR_ZERO = address(0);
@@ -34,23 +32,23 @@ contract TestDoubleLinkedList is Test {
3432
}
3533

3634
function testShouldNotInsertAccountWithZeroValue() public {
37-
hevm.expectRevert(abi.encodeWithSignature("ValueIsZero()"));
35+
vm.expectRevert(abi.encodeWithSignature("ValueIsZero()"));
3836
list.insertSorted(accounts[0], 0, NDS);
3937
}
4038

4139
function testShouldNotInsertZeroAddress() public {
42-
hevm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
40+
vm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
4341
list.insertSorted(address(0), 10, NDS);
4442
}
4543

4644
function testShouldNotRemoveAccountThatDoesNotExist() public {
47-
hevm.expectRevert(abi.encodeWithSignature("AccountDoesNotExist()"));
45+
vm.expectRevert(abi.encodeWithSignature("AccountDoesNotExist()"));
4846
list.remove(accounts[0]);
4947
}
5048

5149
function testShouldInsertSeveralTimesTheSameAccount() public {
5250
list.insertSorted(accounts[0], 1, NDS);
53-
hevm.expectRevert(abi.encodeWithSignature("AccountAlreadyInserted()"));
51+
vm.expectRevert(abi.encodeWithSignature("AccountAlreadyInserted()"));
5452
list.insertSorted(accounts[0], 2, NDS);
5553
}
5654

test-foundry/TestHeap.t.sol

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// SPDX-License-Identifier: GNU AGPLv3
22
pragma solidity ^0.8.0;
33

4-
import "ds-test/test.sol";
5-
import "forge-std/Vm.sol";
4+
import "forge-std/Test.sol";
65

76
import "@contracts/Heap.sol";
87

9-
contract TestHeap is DSTest {
8+
contract TestHeap is Test {
109
using BasicHeap for BasicHeap.Heap;
1110

12-
Vm public hevm = Vm(HEVM_ADDRESS);
13-
1411
uint256 public TESTED_SIZE = 50;
1512
address[] public accounts;
1613
address public ADDR_ZERO = address(0);
@@ -36,25 +33,25 @@ contract TestHeap is DSTest {
3633
}
3734

3835
function testShouldNotInsertAccountWithZeroValue() public {
39-
hevm.expectRevert(abi.encodeWithSignature("WrongValue()"));
36+
vm.expectRevert(abi.encodeWithSignature("WrongValue()"));
4037
heap.insert(accounts[0], 0);
4138

4239
assertEq(heap.getSize(), 0);
4340
}
4441

4542
function testShouldNotInsertZeroAddress() public {
46-
hevm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
43+
vm.expectRevert(abi.encodeWithSignature("AddressIsZero()"));
4744
heap.insert(address(0), 10);
4845
}
4946

5047
function testShouldInsertSeveralTimesTheSameAccount() public {
5148
heap.insert(accounts[0], 1);
52-
hevm.expectRevert(abi.encodeWithSignature("AccountAlreadyInserted()"));
49+
vm.expectRevert(abi.encodeWithSignature("AccountAlreadyInserted()"));
5350
heap.insert(accounts[0], 2);
5451
}
5552

5653
function testShouldNotRemoveAccountThatDoesNotExist() public {
57-
hevm.expectRevert(abi.encodeWithSignature("AccountDoesNotExist()"));
54+
vm.expectRevert(abi.encodeWithSignature("AccountDoesNotExist()"));
5855
heap.remove(accounts[0]);
5956
}
6057

test-foundry/TestHeapOrdering.t.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: GNU AGPLv3
22
pragma solidity ^0.8.0;
33

4-
import "ds-test/test.sol";
5-
import "forge-std/Vm.sol";
64
import "forge-std/console.sol";
75

86
import "./TestCommonHeapOrdering.t.sol";

test-foundry/TestInvariantHeapOrdering.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// SPDX-License-Identifier: GNU AGPLv3
22
pragma solidity ^0.8.0;
33

4-
import "ds-test/test.sol";
5-
import "forge-std/Vm.sol";
4+
import "forge-std/Test.sol";
65
import "forge-std/console.sol";
76

87
import "./helpers/ConcreteHeapOrdering.sol";
@@ -21,7 +20,7 @@ contract Heap is ConcreteHeapOrdering {
2120
}
2221
}
2322

24-
contract TestHeapInvariant is DSTest {
23+
contract TestHeapInvariant is Test {
2524
Heap public heap;
2625

2726
function setUp() public {

test-foundry/TestInvariantThreeHeapOrdering.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// SPDX-License-Identifier: GNU AGPLv3
22
pragma solidity ^0.8.0;
33

4-
import "ds-test/test.sol";
5-
import "forge-std/Vm.sol";
4+
import "forge-std/Test.sol";
65
import "forge-std/console.sol";
76

87
import "./helpers/ConcreteThreeHeapOrdering.sol";
@@ -21,7 +20,7 @@ contract Heap is ConcreteThreeHeapOrdering {
2120
}
2221
}
2322

24-
contract TestHeapInvariant is DSTest {
23+
contract TestHeapInvariant is Test {
2524
Heap public heap;
2625

2726
function setUp() public {

test-foundry/TestStressHeap.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GNU AGPLv3
22
pragma solidity ^0.8.0;
33

4-
import "ds-test/test.sol";
4+
import "forge-std/Test.sol";
55

66
import "@contracts/Heap.sol";
77

0 commit comments

Comments
 (0)