mirror of openzeppelin-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
openzeppelin-contracts/test/utils/Strings.t.sol

27 lines
715 B

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Test} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
contract StringsTest is Test {
using Strings for *;
function testParse(uint256 value) external {
assertEq(value, value.toString().parseUint());
}
function testParseSigned(int256 value) external {
assertEq(value, value.toStringSigned().parseInt());
}
function testParseHex(uint256 value) external {
assertEq(value, value.toHexString().parseHexUint());
}
function testParseChecksumHex(address value) external {
assertEq(value, value.toChecksumHexString().parseAddress());
}
}