| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package mapPathfind
- import (
- cherryApp "f1-game/internal/cherry_app"
- "f1-game/internal/data"
- "testing"
- "github.com/cherry-game/cherry"
- cprofile "github.com/cherry-game/cherry/profile"
- )
- func TestMain(m *testing.M) {
- _, err := cprofile.Init("../../../etc/profile/dev.json", "map-1")
- if err != nil {
- panic(err)
- }
- builder := cherry.Configure("../../../etc/profile/dev.json", "map-1", false, cherry.Standalone)
- cherryApp.Init(builder)
- c := data.New()
- builder.Register(c)
- go builder.Startup()
- // c.Init()
- // c.OnAfterInit()
- m.Run()
- // c.OnBeforeStop()
- // c.OnStop()
- }
- func TestPathfind(t *testing.T) {
- // time.Sleep(3 * time.Second)
- // barrierData := mapTypes.NewBarrierData()
- // pathfind := newActorPathfind(barrierData)
- // pathfind.initAreas()
- // path, errCode := pathfind.findPath(&pb.Point2{
- // Start: &pb.Point{X: 240, Y: 883},
- // End: &pb.Point{X: 243, Y: 891},
- // })
- // if code.IsFail(errCode) {
- // t.Fatalf("find path failed: code = %d", errCode)
- // }
- // for _, point := range path.List {
- // fmt.Printf("(%d, %d)\n", point.X, point.Y)
- // }
- }
|