forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibClock.t.sol
21 lines (18 loc) · 988 Bytes
/
LibClock.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol";
import { LibClock } from "../src/dispute/lib/LibClock.sol";
import "../src/libraries/DisputeTypes.sol";
/// @notice Tests for `LibClock`
contract LibClock_Test is Test {
/// @notice Tests that the `duration` function correctly shifts out the `Duration` from a packed `Clock` type.
function testFuzz_duration_succeeds(Duration _duration, Timestamp _timestamp) public {
Clock clock = LibClock.wrap(_duration, _timestamp);
assertEq(Duration.unwrap(clock.duration()), Duration.unwrap(_duration));
}
/// @notice Tests that the `timestamp` function correctly shifts out the `Timestamp` from a packed `Clock` type.
function testFuzz_timestamp_succeeds(Duration _duration, Timestamp _timestamp) public {
Clock clock = LibClock.wrap(_duration, _timestamp);
assertEq(Timestamp.unwrap(clock.timestamp()), Timestamp.unwrap(_timestamp));
}
}