From 5966eeba05a2d55ae3a7951d99da9b53840d539f Mon Sep 17 00:00:00 2001 From: "Chan, Danny" Date: Mon, 21 Aug 2023 06:41:34 +0000 Subject: [PATCH] test: testEncodeOrdinary --- .gitignore | 1 + tests/EncodingTest.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 9d66081..d6fdc0f 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,4 @@ _tinker*.php .phpunit.result.cache .phpunit.cache/ composer.lock +coverage diff --git a/tests/EncodingTest.php b/tests/EncodingTest.php index b56b962..73d9db8 100644 --- a/tests/EncodingTest.php +++ b/tests/EncodingTest.php @@ -148,6 +148,14 @@ public function testDecodeWithSpecial() } public function testEncodeOrdinary() + { + $enc = EncodingFactory::createByEncodingName('cl100k_base'); + $tokens = $enc->encodeOrdinary('Hello world'); + + $this->assertSame([9906, 1917], $tokens); + } + + public function testEncodeOrdinaryWithDisallowedSpecial() { $enc = EncodingFactory::createByEncodingName('cl100k_base'); $tokens1 = $enc->encodeOrdinary('🫡🍣顏文字');