Skip to content

Commit

Permalink
fix: fix SetsValue* tests to account for instantaneous `lastCompute…
Browse files Browse the repository at this point in the history
…dValue` change
  • Loading branch information
kinrezC committed Mar 29, 2024
1 parent 9605b1f commit c6209b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/lib/DynamicParamLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ contract DynamicParamLibTest is Test {
function test_DynamicParamLib_set_SetsValueIncrease() public {
initStoredParam(10, 0, 0, 0);
storedParam.set(20, 10);
assertEq(storedParam.lastComputedValue, 10);
// immediately updates `lastComputedValue` to 11
assertEq(storedParam.lastComputedValue, 11);
assertEq(storedParam.updateEnd, 10);
assertEq(storedParam.lastUpdateAt, block.timestamp);
assertEq(storedParam.updatePerSecond, 1);
Expand All @@ -109,7 +110,8 @@ contract DynamicParamLibTest is Test {
function test_DynamicParamLib_set_SetsValueDecrease() public {
initStoredParam(20, 0, 0, 0);
storedParam.set(10, 10);
assertEq(storedParam.lastComputedValue, 20);
// immediately updates `lastComputedValue` to 19
assertEq(storedParam.lastComputedValue, 19);
assertEq(storedParam.updateEnd, 10);
assertEq(storedParam.lastUpdateAt, block.timestamp);
assertEq(storedParam.updatePerSecond, -1);
Expand Down

0 comments on commit c6209b8

Please sign in to comment.