58 lines
807 B
Go
58 lines
807 B
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"legu.airobot/busi/friend"
|
|
"legu.airobot/lib"
|
|
)
|
|
|
|
func TestAction(t *testing.T) {
|
|
aip := lib.AIParam{
|
|
RobotCount: 1,
|
|
}
|
|
ai, _ := lib.NewAI(aip)
|
|
//注册caller
|
|
friend_recommend := &friend.FriendRecommend{}
|
|
friend_recommend.Desc = ""
|
|
ai.InitCaller(
|
|
friend_recommend,
|
|
)
|
|
|
|
// 创建场景
|
|
scene := lib.NewScene(ai, lib.SceneParam{
|
|
Name: "场景1",
|
|
Desc: "好友",
|
|
})
|
|
|
|
//为场景选择caller
|
|
scene.AddCaller(&friend.FriendRecommend{})
|
|
|
|
//加机器人
|
|
ai.AddRobot(scene)
|
|
|
|
//运行机器人
|
|
for _, v := range ai.GetRobots("场景1") {
|
|
v.Start()
|
|
}
|
|
|
|
}
|
|
|
|
func TestA(t *testing.T) {
|
|
|
|
q := lib.NewQueue[int]()
|
|
q.Add(1)
|
|
q.Add(2)
|
|
|
|
// list := q.List()
|
|
for {
|
|
i, err := q.Pop()
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
fmt.Println(i)
|
|
}
|
|
}
|