github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/test/dispute/lib/LibClock.t.sol (about)

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity ^0.8.15;
     3  
     4  import { Test } from "forge-std/Test.sol";
     5  import { LibClock } from "src/dispute/lib/LibUDT.sol";
     6  import "src/libraries/DisputeTypes.sol";
     7  
     8  /// @notice Tests for `LibClock`
     9  contract LibClock_Test is Test {
    10      /// @notice Tests that the `duration` function correctly shifts out the `Duration` from a packed `Clock` type.
    11      function testFuzz_duration_succeeds(Duration _duration, Timestamp _timestamp) public {
    12          Clock clock = LibClock.wrap(_duration, _timestamp);
    13          assertEq(Duration.unwrap(clock.duration()), Duration.unwrap(_duration));
    14      }
    15  
    16      /// @notice Tests that the `timestamp` function correctly shifts out the `Timestamp` from a packed `Clock` type.
    17      function testFuzz_timestamp_succeeds(Duration _duration, Timestamp _timestamp) public {
    18          Clock clock = LibClock.wrap(_duration, _timestamp);
    19          assertEq(Timestamp.unwrap(clock.timestamp()), Timestamp.unwrap(_timestamp));
    20      }
    21  }