Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Tests](https://github.com/element-fi/hyperdrive/actions/workflows/test.yml/badge.svg)](https://github.com/element-fi/hyperdrive/actions/workflows/test.yml)
[![Coverage](https://coveralls.io/repos/github/element-fi/hyperdrive/badge.svg?t=US78Aq)](https://coveralls.io/github/element-fi/hyperdrive)
[![Coverage](https://coveralls.io/repos/github/element-fi/hyperdrive/badge.svg?branch=main&t=US78Aq)](https://coveralls.io/github/element-fi/hyperdrive?branch=main)

# Hyperdrive

Expand Down
11 changes: 8 additions & 3 deletions test/combinatorial/MultiToken._transferFrom.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
}

struct TestCase {
uint256 index;
// -- args
uint256 tokenId;
address from;
Expand Down Expand Up @@ -55,6 +56,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
uint256 approvals = rawTestCases[i][2];
bool approvedForAll = approvals == type(uint128).max;
TestCase memory testCase = TestCase({
index: i,
tokenId: ((i + 5) ** 4) / 7,
from: alice,
to: bob,
Expand All @@ -65,7 +67,6 @@ contract MultiToken__transferFrom is CombinatorialTest {
balanceTo: rawTestCases[i][3],
approvedForAll: approvedForAll
});
__log("--", i, testCase);
__setup(testCase);
__fail(testCase);
__success(testCase);
Expand Down Expand Up @@ -139,6 +140,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
testCase.caller
)
{
__log(unicode"❎", testCase);
revert ExpectedFail();
} catch (bytes memory e) {
// NOTE: __error and __fail_error must be assigned here to
Expand Down Expand Up @@ -200,6 +202,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
testCase.caller
)
{} catch {
__log(unicode"❎", testCase);
revert ExpectedSuccess();
}

Expand All @@ -219,6 +222,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
);

if (callerApprovalsDiff != testCase.amount) {
__log(unicode"❎", testCase);
assertEq(
callerApprovalsDiff,
testCase.amount,
Expand All @@ -231,6 +235,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
uint256 fromBalanceDiff = preBalanceFrom -
multiToken.balanceOf(testCase.tokenId, testCase.from);
if (fromBalanceDiff != testCase.amount) {
__log(unicode"❎", testCase);
assertEq(
fromBalanceDiff,
testCase.amount,
Expand All @@ -244,6 +249,7 @@ contract MultiToken__transferFrom is CombinatorialTest {
testCase.to
) - preBalanceTo;
if (toBalanceDiff != testCase.amount) {
__log(unicode"❎", testCase);
assertEq(
toBalanceDiff,
testCase.amount,
Expand All @@ -254,11 +260,10 @@ contract MultiToken__transferFrom is CombinatorialTest {

function __log(
string memory prelude,
uint256 index,
TestCase memory testCase
) internal view {
console2.log("%s :: { TestCase #%s }", prelude, index);
console2.log("");
console2.log("%s Fail :: { TestCase #%s }\n", prelude, testCase.index);
console2.log("\ttokenId = ", testCase.tokenId);
console2.log("\tfrom = ", testCase.from);
console2.log("\tto = ", testCase.to);
Expand Down