mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
80 lines
2.1 KiB
PHP
Executable File
80 lines
2.1 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Jingga
|
|
*
|
|
* PHP Version 8.1
|
|
*
|
|
* @package tests
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 2.0
|
|
* @version 1.0.0
|
|
* @link https://jingga.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\tests\System\Search;
|
|
|
|
use phpOMS\System\Search\StringSearch;
|
|
|
|
/**
|
|
* @testdox phpOMS\tests\System\Search\StringSearchTest: Search utilities
|
|
*
|
|
* @internal
|
|
*/
|
|
final class StringSearchTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testKnutMorrisPrattSearch() : void
|
|
{
|
|
self::assertEquals(15, StringSearch::knuthMorrisPrattSearch('ABCDABD', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testInvalidKnutMorrisPrattSearch() : void
|
|
{
|
|
self::assertEquals(-1, StringSearch::knuthMorrisPrattSearch('ABCDABDZ', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testBoyerMooreHorspoolSimpleSearch() : void
|
|
{
|
|
self::assertEquals(15, StringSearch::boyerMooreHorspoolSimpleSearch('ABCDABD', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testInvalidBoyerMooreHorspoolSimpleSearch() : void
|
|
{
|
|
self::assertEquals(-1, StringSearch::boyerMooreHorspoolSimpleSearch('ABCDABDZ', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testBoyerMooreHorspoolSearch() : void
|
|
{
|
|
self::assertEquals(15, StringSearch::boyerMooreHorspoolSearch('ABCDABD', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
|
|
/**
|
|
* @covers \phpOMS\System\Search\StringSearch
|
|
* @group framework
|
|
*/
|
|
public function testInvalidBoyerMooreHorspoolSearch() : void
|
|
{
|
|
self::assertEquals(-1, StringSearch::boyerMooreHorspoolSearch('ABCDABDZ', 'ABC ABCDAB ABCDABCDABDE'));
|
|
}
|
|
}
|