12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace Test\Unit;
- use Test\TestCase;
- use Web3\Formatters\HexFormatter;
- class HexFormatterTest extends TestCase
- {
-
- protected $formatter;
-
- public function setUp()
- {
- parent::setUp();
- $this->formatter = new HexFormatter;
- }
-
- public function testFormat()
- {
- $formatter = $this->formatter;
- $hex = $formatter->format('ae');
- $this->assertEquals($hex, '0x6165');
- $hex = $formatter->format('0xabce');
- $this->assertEquals($hex, '0xabce');
- $hex = $formatter->format('123');
- $this->assertEquals($hex, '0x7b');
- $hex = $formatter->format(12);
- $this->assertEquals($hex, '0xc');
- }
- }
|