diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index d48b8ed..a2bfb81 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -65,8 +65,13 @@ final class NodaTimeSplitter { "nach Chr." => "", "n. Chr." => "", "n.Chr." => "", + " pp" => "", + " p" => "", + " р" => "", // Cyrillic // To clean "v.Chr." => "v. Chr.", + "v.C." => "v. Chr.", + "v. C." => "v. Chr.", "v. Chr" => "v. Chr.", "BCE" => "v. Chr.", "CE" => "", diff --git a/tests/NodaTimeSplitterTest.php b/tests/NodaTimeSplitterTest.php index a9b4583..8853222 100644 --- a/tests/NodaTimeSplitterTest.php +++ b/tests/NodaTimeSplitterTest.php @@ -342,6 +342,19 @@ final class NodaTimeSplitterTest extends TestCase { self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr."); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500); + // 5-Digit timespans BCE + $output = NodaTimeSplitter::attempt_splitting("40000-25000 v.C."); + self::assertEquals($output, [ + 0 => "-40000", + 1 => "-25000", + 2 => "00", + 3 => "00", + 4 => "-", + 5 => "", + ]); + self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr."); + self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500); + $output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert v. Chr."); self::assertEquals($output, [ 0 => "-2000", @@ -806,6 +819,31 @@ final class NodaTimeSplitterTest extends TestCase { } + /** + * Test to check whether the HTML page is correctly generated. + * + * @author Joshua Ramon Enslin + * @group ValidOutput + * @small + * + * @return void + */ + public function testSplitSimpleDatesUkrainian():void { + + $output = NodaTimeSplitter::attempt_splitting("2020 p"); + self::assertEquals($output, [ + 0 => "2020", + 1 => "2020", + 2 => "00", + 3 => "00", + 4 => "+", + 5 => "", + ]); + self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2020"); + self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); + + } + /** * Test to check special cases can be parsed. *