Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
f964aea9
Commit
f964aea9
authored
Aug 30, 2023
by
Bruce MacDonald
Browse files
remove test not applicate to subprocess
parent
42998d79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
79 deletions
+0
-79
llm/llama_test.go
llm/llama_test.go
+0
-79
No files found.
llm/llama_test.go
deleted
100644 → 0
View file @
42998d79
package
llm
import
(
"bytes"
"testing"
)
func
TestCheckStopConditions
(
t
*
testing
.
T
)
{
tests
:=
map
[
string
]
struct
{
b
string
stop
[]
string
wantB
string
wantStop
bool
wantEndsWithStopPrefix
bool
}{
"not present"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"x"
},
wantStop
:
false
,
wantEndsWithStopPrefix
:
false
,
},
"exact"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"abc"
},
wantStop
:
true
,
wantEndsWithStopPrefix
:
false
,
},
"substring"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"b"
},
wantB
:
"a"
,
wantStop
:
true
,
wantEndsWithStopPrefix
:
false
,
},
"prefix 1"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"abcd"
},
wantStop
:
false
,
wantEndsWithStopPrefix
:
true
,
},
"prefix 2"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"bcd"
},
wantStop
:
false
,
wantEndsWithStopPrefix
:
true
,
},
"prefix 3"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"cd"
},
wantStop
:
false
,
wantEndsWithStopPrefix
:
true
,
},
"no prefix"
:
{
b
:
"abc"
,
stop
:
[]
string
{
"bx"
},
wantStop
:
false
,
wantEndsWithStopPrefix
:
false
,
},
}
for
name
,
test
:=
range
tests
{
t
.
Run
(
name
,
func
(
t
*
testing
.
T
)
{
var
b
bytes
.
Buffer
b
.
WriteString
(
test
.
b
)
stop
,
endsWithStopPrefix
:=
handleStopSequences
(
&
b
,
test
.
stop
)
if
test
.
wantB
!=
""
{
gotB
:=
b
.
String
()
if
gotB
!=
test
.
wantB
{
t
.
Errorf
(
"got b %q, want %q"
,
gotB
,
test
.
wantB
)
}
}
if
stop
!=
test
.
wantStop
{
t
.
Errorf
(
"got stop %v, want %v"
,
stop
,
test
.
wantStop
)
}
if
endsWithStopPrefix
!=
test
.
wantEndsWithStopPrefix
{
t
.
Errorf
(
"got endsWithStopPrefix %v, want %v"
,
endsWithStopPrefix
,
test
.
wantEndsWithStopPrefix
)
}
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment