index/tests/Base32Test.php

33 lines
925 B
PHP
Raw Normal View History

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