fonchain-fiee/pkg/common/gpt/gpt_test.go
2025-02-20 16:24:49 +08:00

43 lines
1.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package gpt
import (
"fmt"
"testing"
)
func TestGptContent(t *testing.T) {
type args struct {
content string
}
InitSet("https://erpapi.fontree.cn", "18021272627", "Gy.123456")
tests := []struct {
name string
args args
want string
wantErr bool
}{
// TODO: Add test cases.
{args: args{content: "i want many nice cars"}},
{args: args{content: "you are so beautiful,i like(把前面文字翻译成中文,去除斜杠,本括号内的忽略)"}},
{args: args{content: "有一个美丽的蓝色天空,天空下边站着一个小孩,小孩穿着绿色的衣服,绿色的帽子,帽子上有个毛毛虫(把前面文字翻译成英语,如果前面是英语则原样返回,去除斜杠,本括号内的忽略)"}},
{args: args{content: "翻译成英语当日密码错误2次请重试"}},
{args: args{content: "翻译成日语当日密码错误2次请重试"}},
{args: args{content: "翻译成繁体当日密码错误2次请重试"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := gptContent(tt.args.content)
fmt.Println(got)
if (err != nil) != tt.wantErr {
t.Errorf("GptContent() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("GptContent() got = %v, want %v", got, tt.want)
}
})
}
}