diff --git a/test/rootFinder.t.sol b/test/rootFinder.t.sol index 7a8db20..b84fa7f 100644 --- a/test/rootFinder.t.sol +++ b/test/rootFinder.t.sol @@ -12,14 +12,13 @@ contract RootFinderTest is Test { rootFinder = new RootFinder(); } - // Test findRootNewX to ensure it converges on the expected result - // for a given set of input parameters + // Test findRootNewX to ensure it converges function testFindRootNewX() public { // Define inputs for findRootNewX uint256 reserveY_ = 1000 ether; uint256 liquidity = 5000 ether; uint256 strike_ = 1500 ether; - uint256 sigma_ = 1e18; // 100% volatility + uint256 sigma_ = 8e17; // 80% volatility uint256 tau_ = 365 days; // 1-year duration bytes memory args = abi.encode(reserveY_, liquidity, strike_, sigma_, tau_); @@ -32,7 +31,7 @@ contract RootFinderTest is Test { assertApproxEqAbs(result, expectedValue, 1 ether, "Root did not converge to expected value within tolerance"); } - // Test computeTfDReserveX to verify the accuracy of the derivative computation + // Test computeTfDReserveX to ensure accuracy of f'(L) function testComputeTfDReserveX() public { // Define inputs for derivative computation uint256 reserveY_ = 1000 ether; @@ -53,8 +52,8 @@ contract RootFinderTest is Test { // Test findX function to ensure it returns the expected value for given inputs function testFindX() public { // Test data for findX - uint256 reserveY_ = 1000 ether; - uint256 liquidity = 5000 ether; + uint256 reserveY_ = 10 ether; + uint256 liquidity = 500 ether; uint256 strike_ = 1500 ether; uint256 sigma_ = 1e18; // 100% volatility uint256 tau_ = 365 days; // 1-year duration @@ -70,11 +69,11 @@ contract RootFinderTest is Test { // Test computeTradingFunction with known parameters to verify correct calculation function testComputeTradingFunction() public { - uint256 reserveX_ = 2000 ether; - uint256 reserveY_ = 3000 ether; + uint256 reserveX_ = 200 ether; + uint256 reserveY_ = 10 ether; uint256 liquidity = 10000 ether; uint256 strike_ = 1500 ether; - uint256 sigma_ = 1e18; // 100% volatility + uint256 sigma_ = 8e17; // 80% volatility uint256 tau_ = 365 days; // 1-year duration int256 result = rootFinder.computeTradingFunction(reserveX_, reserveY_, liquidity, strike_, sigma_, tau_); @@ -85,12 +84,12 @@ contract RootFinderTest is Test { // Test computeSigmaSqrtTau to ensure correct calculation of sigma * sqrt(tau) function testComputeSigmaSqrtTau() public { - uint256 sigma_ = 1e18; // 100% volatility + uint256 sigma_ = 8e17; // 80% volatility uint256 tau_ = 365 days; // 1-year duration uint256 result = rootFinder.computeSigmaSqrtTau(sigma_, tau_); - uint256 expectedValue = 1e18; // TODO: Replace with actual expected sigma * sqrt(tau) result + uint256 expectedValue = 1157e14; // TODO: Replace with actual expected sigma * sqrt(tau) result assertApproxEqAbs(result, expectedValue, 1e16, "computeSigmaSqrtTau result does not match expected value"); }