summaryrefslogtreecommitdiff
path: root/check.lua
diff options
context:
space:
mode:
Diffstat (limited to 'check.lua')
-rw-r--r--check.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/check.lua b/check.lua
index 8a2d200..d0617a5 100644
--- a/check.lua
+++ b/check.lua
@@ -34,7 +34,10 @@ local function check()
local u={inputTokens=155,outputTokens=41,thoughtTokens=8,cachedReadTokens=55,cachedWriteTokens=10,totalTokens=196}
local v=usage(u); assert(v.input==90 and v.output==41 and v.cache_read==55 and v.cache_write==10 and v.reasoning==8)
u.totalTokens=261; assert(usage(u).input==155); u.totalTokens=99; assert(not usage(u) and not usage({}) and not usage(nil))
- local catalog=dofile(root..'/catalog.lua').catalog
+ local cat=dofile(root..'/catalog.lua'); local catalog=cat.catalog
+ local wide='a'..('\u{754C}'):rep(8000); local pages=cat.pages(wide) -- no newline to cut at: characters stay whole
+ assert(#pages==3 and table.concat(pages)==wide and #cat.pages('abc')==1)
+ for i,p in ipairs(pages) do assert(utf8.len(p) and #cat.part(pages,7,i)<=cat.result_bytes) end
local req={tools={{name='std.read',description='Read',input_schema_json='{"type":"object"}'},
{name='fixture.echo',description='Echo',input_schema_json='{"type":"object"}'}}}
local _,none=catalog(req,{}); assert(#none==0)