Skip to content

PlayerController 테스트 코드 작성#51

Merged
Joseph-Cha merged 3 commits intoPlayerControllerfrom
PlayerControllerUnitTest
Jul 15, 2021
Merged

PlayerController 테스트 코드 작성#51
Joseph-Cha merged 3 commits intoPlayerControllerfrom
PlayerControllerUnitTest

Conversation

@Joseph-Cha
Copy link
Owner

테스트 코드 설계 참고 : #47

이슈에 남겼던 테스트 코드 설계했던 대로 작성을 해보았습니다.
아마 작업하다 보면 좀 수정이 예상되지만 우선 최대한 저 테스트를 기반으로 구현을 해볼게요.

Copy link
Collaborator

@jongfeel jongfeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 코드의 while loop 이해하는데 조금 어려운 것 같습니다.
쉬운 방법으로 해봤으면 좋겠네요.

또, Player.UpdateDestination() method가 없는 거 같은데 빌드가 됐나요?

var obj = new GameObject();
Player player = obj.AddComponent<Player>();
InputInfo inputInfo;
Vector2Int curPos = player.Position;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player.Position is (0, 0)?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly Right!

}

frameCount++;
} while(frameCount <= 10);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up: 4 step
Down: 1 step
Right: 1 step
Left: 3 step

Start position is (0, 0), it will be changes to (-2, 3) until while loop.
But, start position is (1, 1) to (-1, 2). right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-2, 3이 맞아요 ㅋㅋㅋ
frameCount++를 하고 이동하는 줄 알고 계산을 했었는데
이동을 다하고 frameCount++를 하는 거였군요 ㅋㅋ;;

일단 while 루프가 좀 애매한 것 같아서 다른 방법을 찾아볼게요!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

커밋 : 1fe033d

랜덤으로 이동한 위치가 원하는 위치인지 테스트하는 방식으로 수정했어요~

@Joseph-Cha
Copy link
Owner Author

테스트 코드의 while loop 이해하는데 조금 어려운 것 같습니다.
쉬운 방법으로 해봤으면 좋겠네요.

또, Player.UpdateDestination() method가 없는 거 같은데 빌드가 됐나요?

Player 스크립트를 안올렸었군요;;;;
핑계이긴 하지만 설계에 보면 Player.UpdateDestination() method가 있습니당
Test코드 작성할 때도 설계문서를 보고 만들었기 때문에 Player.UpdateDestination() method가 Player에 있습니다 ㅎㅎ

@jongfeel
Copy link
Collaborator

실제 UI로 보여질 수 있게 하면 좋을 것 같습니다.

  • 타일맵
  • 캐릭터

등등

@Joseph-Cha
Copy link
Owner Author

테스트 코드의 while loop 이해하는데 조금 어려운 것 같습니다.
쉬운 방법으로 해봤으면 좋겠네요.

또, Player.UpdateDestination() method가 없는 거 같은데 빌드가 됐나요?

커밋 : 836662c

전에 올리지 못했던 Player 스크립트입니다~

@Joseph-Cha Joseph-Cha merged commit b2a7390 into PlayerController Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unit test Test Code 작성

Projects

None yet

Development

Successfully merging this pull request may close these issues.

플레이어 이동 테스트 코드 작성 및 빈 오브젝트 생성

2 participants