Skip to content

Commit

Permalink
add testEncodeOrdinary
Browse files Browse the repository at this point in the history
  • Loading branch information
danny50610 committed Aug 20, 2023
1 parent de8465d commit 2de45e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/EncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,13 @@ public function testDecodeWithSpecial()
$this->assertSame('Hello World<|endoftext|>Hello danny.', $text);
}

// TODO: test: encodeOrdinary === encode($text, disallowedSpecial: [])
public function testEncodeOrdinary()
{
$enc = EncodingFactory::createByEncodingName('cl100k_base');
$tokens1 = $enc->encodeOrdinary('🫡🍣顏文字');
$tokens2 = $enc->encode('🫡🍣顏文字', disallowedSpecial: []);

$this->assertSame([9468, 104, 94, 9468, 235, 96, 14167, 237, 88435], $tokens1);
$this->assertSame($tokens1, $tokens2);
}
}

0 comments on commit 2de45e4

Please sign in to comment.