pathfind_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package mapPathfind
  2. import (
  3. cherryApp "f1-game/internal/cherry_app"
  4. "f1-game/internal/data"
  5. "testing"
  6. "github.com/cherry-game/cherry"
  7. cprofile "github.com/cherry-game/cherry/profile"
  8. )
  9. func TestMain(m *testing.M) {
  10. _, err := cprofile.Init("../../../etc/profile/dev.json", "map-1")
  11. if err != nil {
  12. panic(err)
  13. }
  14. builder := cherry.Configure("../../../etc/profile/dev.json", "map-1", false, cherry.Standalone)
  15. cherryApp.Init(builder)
  16. c := data.New()
  17. builder.Register(c)
  18. go builder.Startup()
  19. // c.Init()
  20. // c.OnAfterInit()
  21. m.Run()
  22. // c.OnBeforeStop()
  23. // c.OnStop()
  24. }
  25. func TestPathfind(t *testing.T) {
  26. // time.Sleep(3 * time.Second)
  27. // barrierData := mapTypes.NewBarrierData()
  28. // pathfind := newActorPathfind(barrierData)
  29. // pathfind.initAreas()
  30. // path, errCode := pathfind.findPath(&pb.Point2{
  31. // Start: &pb.Point{X: 240, Y: 883},
  32. // End: &pb.Point{X: 243, Y: 891},
  33. // })
  34. // if code.IsFail(errCode) {
  35. // t.Fatalf("find path failed: code = %d", errCode)
  36. // }
  37. // for _, point := range path.List {
  38. // fmt.Printf("(%d, %d)\n", point.X, point.Y)
  39. // }
  40. }