mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 05:50:50 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/bl/test/convert.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/bl/test/convert.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
const tape = require('tape')
|
||||
const { BufferList, BufferListStream } = require('../')
|
||||
const { Buffer } = require('buffer')
|
||||
|
||||
tape('convert from BufferList to BufferListStream', (t) => {
|
||||
const data = Buffer.from(`TEST-${Date.now()}`)
|
||||
const bl = new BufferList(data)
|
||||
const bls = new BufferListStream(bl)
|
||||
t.ok(bl.slice().equals(bls.slice()))
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('convert from BufferListStream to BufferList', (t) => {
|
||||
const data = Buffer.from(`TEST-${Date.now()}`)
|
||||
const bls = new BufferListStream(data)
|
||||
const bl = new BufferList(bls)
|
||||
t.ok(bl.slice().equals(bls.slice()))
|
||||
t.end()
|
||||
})
|
||||
64
unified-ai-platform/node_modules/bl/test/indexOf.js
generated
vendored
Normal file
64
unified-ai-platform/node_modules/bl/test/indexOf.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict'
|
||||
|
||||
const tape = require('tape')
|
||||
const BufferList = require('../')
|
||||
const { Buffer } = require('buffer')
|
||||
|
||||
tape('indexOf single byte needle', (t) => {
|
||||
const bl = new BufferList(['abcdefg', 'abcdefg', '12345'])
|
||||
|
||||
t.equal(bl.indexOf('e'), 4)
|
||||
t.equal(bl.indexOf('e', 5), 11)
|
||||
t.equal(bl.indexOf('e', 12), -1)
|
||||
t.equal(bl.indexOf('5'), 18)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('indexOf multiple byte needle', (t) => {
|
||||
const bl = new BufferList(['abcdefg', 'abcdefg'])
|
||||
|
||||
t.equal(bl.indexOf('ef'), 4)
|
||||
t.equal(bl.indexOf('ef', 5), 11)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('indexOf multiple byte needles across buffer boundaries', (t) => {
|
||||
const bl = new BufferList(['abcdefg', 'abcdefg'])
|
||||
|
||||
t.equal(bl.indexOf('fgabc'), 5)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('indexOf takes a Uint8Array search', (t) => {
|
||||
const bl = new BufferList(['abcdefg', 'abcdefg'])
|
||||
const search = new Uint8Array([102, 103, 97, 98, 99]) // fgabc
|
||||
|
||||
t.equal(bl.indexOf(search), 5)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('indexOf takes a buffer list search', (t) => {
|
||||
const bl = new BufferList(['abcdefg', 'abcdefg'])
|
||||
const search = new BufferList('fgabc')
|
||||
|
||||
t.equal(bl.indexOf(search), 5)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('indexOf a zero byte needle', (t) => {
|
||||
const b = new BufferList('abcdef')
|
||||
const bufEmpty = Buffer.from('')
|
||||
|
||||
t.equal(b.indexOf(''), 0)
|
||||
t.equal(b.indexOf('', 1), 1)
|
||||
t.equal(b.indexOf('', b.length + 1), b.length)
|
||||
t.equal(b.indexOf('', Infinity), b.length)
|
||||
t.equal(b.indexOf(bufEmpty), 0)
|
||||
t.equal(b.indexOf(bufEmpty, 1), 1)
|
||||
t.equal(b.indexOf(bufEmpty, b.length + 1), b.length)
|
||||
t.equal
|
||||
Reference in New Issue
Block a user