Skip to content

Commit

Permalink
Update SupportTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
puklipo committed Dec 11, 2024
1 parent 1e3b199 commit e6ec6b0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/Feature/Support/SupportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ public function test_cid_decode()

$hash = hash('sha256', 'test');

$this->assertSame(CID::CID_V1, $cid['version']);
$ver = unpack('C*', $cid['version'])[1];

$this->assertSame(CID::CID_V1, $ver);
$this->assertSame($hash, $cid['hash']);
}

Expand All @@ -288,6 +290,16 @@ public function test_cid_encode_dag_cbor()

$decode = CID::decode($cid);

$this->assertSame(CID::DAG_CBOR, $decode['codec']);
$codec = unpack('C*', $decode['codec'])[1];

$this->assertSame(CID::DAG_CBOR, $codec);
}

public function test_cid_varint()
{
$this->assertSame("\x80\x01", CID::varint(0x80));
$this->assertSame("\xff\x01", CID::varint(0xff));
$this->assertSame("\xac\x02", CID::varint(0x012c));
$this->assertSame("\x80\x80\x01", CID::varint(0x4000));
}
}

0 comments on commit e6ec6b0

Please sign in to comment.