24 $this->assertSame($x->val(), 999);
25 $this->assertSame($x->hexVal(),
'0x00000000000000000000000000000000000000000000000000000000000003e7');
26 $this->assertSame($x->getSchemaType(),
"Q");
35 $hex_null_short =
new EthQ(
'0x');
36 $this->assertSame($hex_null_short->val(), 0);
37 $this->assertSame($hex_null_short->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000000');
39 $hex_null =
new EthQ(
'0x0');
40 $this->assertSame($hex_null->val(), 0);
41 $this->assertSame($hex_null->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000000');
43 $int_null =
new EthQ(0);
44 $this->assertSame($int_null->val(), 0);
45 $this->assertSame($int_null->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000000');
54 $hex_one =
new EthQ(
'0x0000000000000000000000000000000000000000000000000000000000000001');
55 $this->assertSame($hex_one->val(), 1);
56 $this->assertSame($hex_one->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000001');
58 $int_one =
new EthQ(1);
59 $this->assertSame($int_one->val(), 1);
60 $this->assertSame($int_one->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000001');
69 $hex_number =
new EthQ(
'0x000003e7');
70 $this->assertSame($hex_number->val(), 999);
71 $this->assertSame($hex_number->hexVal(),
'0x00000000000000000000000000000000000000000000000000000000000003e7');
81 $this->assertSame($x->val(), -999);
82 $this->assertSame($x->hexVal(),
'0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc19');
89 $z =
new EthQ(
'0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc19');
90 $this->assertSame($z->hexVal(),
'0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc19');
91 $this->assertSame($z->val(), -999);
95 $y =
new EthQ($unpadded->toString());
96 $this->assertSame($y->val(), -999);
97 $this->assertSame($y->hexVal(),
'0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc19');
107 $x =
new EthQ(
'0x000000000000000000000000000000000000000000000000000000000000270f', [
'abi' =>
'uint16']);
108 $this->assertSame($x->val(), 9999);
109 $this->assertSame($x->hexVal(),
'0x000000000000000000000000000000000000000000000000000000000000270f');
117 $x =
new EthQ(
'0x0000270f', [
'abi' =>
'uint16']);
118 $this->assertSame((
int)$x->val(), 9999);
119 $this->assertSame($x->hexVal(),
'0x000000000000000000000000000000000000000000000000000000000000270f');
128 $this->assertSame($x->val(), 255);
129 $this->assertSame($x->hexVal(),
'0x00000000000000000000000000000000000000000000000000000000000000ff');
130 $this->assertSame($x->getAbi(),
'uint8');
139 $this->assertSame($x->val(), 256);
140 $this->assertSame($x->hexVal(),
'0x0000000000000000000000000000000000000000000000000000000000000100');
141 $this->assertSame($x->getAbi(),
'uint16');
150 $this->assertSame($x->val(), -255);
151 $this->assertSame($x->hexVal(),
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01');
152 $this->assertSame($x->getAbi(),
'int8');
161 $this->assertSame($x->val(), -256);
162 $this->assertSame($x->hexVal(),
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00');
163 $this->assertSame($x->getAbi(),
'int16');
171 $x =
new EthQ(
'115792089237316000000000000000000000000000000000000000000000000000000000000000');
172 $this->assertSame($x->val(),
'115792089237316000000000000000000000000000000000000000000000000000000000000000');
173 $this->assertSame($x->hexVal(),
'0xffffffffffff86633a9e8f1256d61ed5325ebf2a4b4366ba0000000000000000');
179 $this->expectException(\InvalidArgumentException::class);
180 new EthQ(9999, [
'abi' =>
'uint8']);
185 $this->expectException(\InvalidArgumentException::class);
186 new EthQ(
'115792089237316000000000000000000000000000000000000000000000000000000000000000115792089237316000000000000000000000000000000000000000000000000000000000000000');
testEthQ__given_abi8_should_be_wrong()
testEthQ__abi8_neg_plus1()