33 lines
981 B
PHP
33 lines
981 B
PHP
|
<?php
|
||
|
// Base32Test.php
|
||
|
// Created: 2021-04-28
|
||
|
// Updated: 2021-04-28
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Index\Serialisation\Serialiser;
|
||
|
|
||
|
/**
|
||
|
* @covers Base32
|
||
|
*/
|
||
|
final class Base32Test extends TestCase {
|
||
|
public const TESTS = [
|
||
|
'A' => '',
|
||
|
'JVUXGYLLMEQE22LLN52G6' => 'Misaka Mikoto',
|
||
|
'IFQUCYKBMFAWCQLBIFQUCYKBME' => 'AaAaAaAaAaAaAaAa',
|
||
|
'JEQGC3JAM5XWS3THEB2G6IDHN4QHI3ZAORUGKIDTN52XAIDTORXXEZJAORXSAYTVPEQGG3DPORUGK4ZO' => 'I am going to go to the soup store to buy clothes.',
|
||
|
'EFACGJBFLYTCUKBJ' => '!@#$%^&*()',
|
||
|
];
|
||
|
|
||
|
public function testDecode(): void {
|
||
|
foreach(self::TESTS as $value => $expected)
|
||
|
$this->assertEquals($expected, (string)Serialiser::base32()->deserialise($value));
|
||
|
}
|
||
|
|
||
|
public function testEncode(): void {
|
||
|
foreach(self::TESTS as $expected => $value)
|
||
|
$this->assertEquals($expected, (string)Serialiser::base32()->serialise($value));
|
||
|
}
|
||
|
}
|