index/tests/Base32Test.php

32 lines
961 B
PHP
Raw Permalink Normal View History

2022-09-13 13:13:11 +00:00
<?php
// Base32Test.php
// Created: 2021-04-28
// Updated: 2024-07-31
2022-09-13 13:13:11 +00:00
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use Index\Base32;
2022-09-13 13:13:11 +00:00
#[CoversClass(Base32::class)]
2022-09-13 13:13:11 +00:00
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
}
}