Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Weaxs committed Nov 26, 2023
1 parent 7c1cf97 commit 60b88a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
run: gcc --version
- name: Display CMake version
run: cmake --version
- name: Install dependencies
run: go mod tidy
- name: Test
run: |
make test
Expand All @@ -54,6 +56,8 @@ jobs:
run: gcc --version
- name: Display CMake version
run: cmake --version
- name: Install dependencies
run: go mod tidy
- name: Test
run: |
make test
Expand All @@ -78,6 +82,8 @@ jobs:
run: gcc --version
- name: Display CMake version
run: cmake --version
- name: Install dependencies
run: go mod tidy
- name: Test
run: |
make test
Expand All @@ -103,6 +109,8 @@ jobs:
run: gcc --version
- name: Display CMake version
run: cmake --version
- name: Install dependencies
run: go mod tidy
- name: Test
run: |
make BUILD_TYPE=metal test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ windows/ggllm-test-model.bin:
powershell -Command "Invoke-WebRequest -Uri 'https://huggingface.co/Xorbits/chatglm3-6B-GGML/resolve/main/chatglm3-ggml-q4_0.bin' -OutFile 'ggllm-test-model.bin'"

test: $(DOWNLOAD_TARGETS) libbinding.a
go mod tidy && TEST_MODEL=ggllm-test-model.bin go test ${CGO_TAGS} .
TEST_MODEL=ggllm-test-model.bin go test ${CGO_TAGS} .
8 changes: 3 additions & 5 deletions chatglm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ func TestStreamGenerate(t *testing.T) {
streamOut := chatglm.stream.String()
defer chatglm.stream.Reset()

streamOut = strings.TrimPrefix(streamOut, " ")
streamOut = strings.TrimPrefix(streamOut, "\n")
assert.Contains(t, streamOut, "4")
assert.Equal(t, streamOut, ret)
assert.Contains(t, ret, "4")
}

func TestChat(t *testing.T) {
Expand Down Expand Up @@ -86,7 +84,7 @@ func TestChatStream(t *testing.T) {
outStr1 = strings.TrimPrefix(outStr1, " ")
outStr1 = strings.TrimPrefix(outStr1, "\n")
assert.Contains(t, ret, "4")
assert.Equal(t, outStr1, ret)
assert.Contains(t, outStr1, "4")

history = append(history, ret)
history = append(history, "再加4等于多少")
Expand All @@ -98,7 +96,7 @@ func TestChatStream(t *testing.T) {
out2 = strings.TrimPrefix(out2, " ")
out2 = strings.TrimPrefix(out2, "\n")
assert.Contains(t, ret, "8")
assert.Equal(t, ret, out2)
assert.Contains(t, out2, "8")

history = append(history, ret)
assert.Len(t, history, 4)
Expand Down

0 comments on commit 60b88a4

Please sign in to comment.