-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pyperf==2.6.3 | ||
tiktoken==0.6.0 | ||
pyperf==2.7.0 | ||
tiktoken==0.7.0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
lib/src/test/java/com/knuddels/jtokkit/EncodingLastProcessedCharacterIndexTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.knuddels.jtokkit; | ||
|
||
import com.knuddels.jtokkit.api.Encoding; | ||
import com.knuddels.jtokkit.api.EncodingType; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class EncodingLastProcessedCharacterIndexTest { | ||
|
||
|
||
private static final Encoding ENCODING = Encodings.newDefaultEncodingRegistry().getEncoding(EncodingType.CL100K_BASE); | ||
|
||
@Test | ||
void testNullInput() { | ||
var encodingResult = ENCODING.encode(null, 10); | ||
assertEquals(encodingResult.getLastProcessedCharacterIndex(), -1); | ||
} | ||
|
||
@Test | ||
void testEmptyInput() { | ||
String input = ""; | ||
var encodingResult = ENCODING.encode(input, 10); | ||
assertEquals(encodingResult.getLastProcessedCharacterIndex(), -1); | ||
} | ||
|
||
@Test | ||
void testShortInput() { | ||
String input = "Hello World!"; | ||
var encodingResult = ENCODING.encode(input, 10); | ||
assertEquals(encodingResult.getLastProcessedCharacterIndex(), 11); | ||
} | ||
|
||
@Test | ||
void testLongInput() { | ||
String input = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce condimentum enim ac tellus malesuada, a consectetur nibh efficitur. 🚀🚀🚀"; | ||
var encodingResult = ENCODING.encode(input, 10); | ||
assertEquals(encodingResult.getLastProcessedCharacterIndex(), 55); | ||
} | ||
} |