32 lines
925 B
PHP
32 lines
925 B
PHP
<?php
|
|
// Base32Test.php
|
|
// Created: 2021-04-28
|
|
// Updated: 2023-07-21
|
|
|
|
declare(strict_types=1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Index\Serialisation\Base32;
|
|
|
|
/**
|
|
* @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, Base32::decode($value));
|
|
}
|
|
|
|
public function testEncode(): void {
|
|
foreach(self::TESTS as $expected => $value)
|
|
$this->assertEquals($expected, Base32::encode($value));
|
|
}
|
|
}
|