// 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));
}
}
-
Mark Tyneway authored
Move the `contracts` directory to `src` and then move the tests into a top level `test` dir so that its standard foundry style for a repo. This is going to break any in flight PRs so worth trying to get in relatively quickly, will be no fun to rebase a bunch of PRs. Will need to follow up with another commit that bumps the patch versions.
f54a2234