일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- DFS
- keras
- install
- E-P1
- mean
- Splunk
- Button
- mariadb
- Numpy
- CNN
- SciPy
- 삼성소프트웨어멤버십
- LSTM
- javascript
- pandas
- Series
- GitHub
- SPL
- Python
- pycharm
- 알고리즘
- GT-S80
- dataframe
- RNN
- ipad
- pip
- index
- synology
- imread
- Lotto
Archives
- Today
- Total
잠토의 잠망경
TDD C++ 실제 예제 2 본문
이어서 좀더 진행해보겠습니다.
Main.cpp를 다음과 같이 바꿔보겠습니다.
- Write a test that fails
- Make the code work
- Eliminate redundancy
[main.cpp]
|
그러면 아래와 같이 class의 멤버함수가 없으므로 error를 발생합니다.
그럼 test code가 실패하지 않도록 코드를 수정하겠습니다.
- Write a test that fails
- Make the code work
- Eliminate redundancy
[student.h]
|
[student.cpp]
|
F5를 누르니 잘된다. ㅎㅎ 이제 Refectoring이다. 고고
- Write a test that fails
- Make the code work
- Eliminate redundancy
우선 호출하는 부위에서 해당 포인터를 가지고 변경하는 실수를 막기위해 const를 추가해봤다.
[student.h]
|
[student.cpp]
|
F5를 눌러보면 success 여기까지도 잘 되었다.
이제 get를 했는니 set되 해볼까? ㅋㅋ
- Write a test that fails
- Make the code work
- Eliminate redundancy
아래와 같이 class 변수 접근 가능한 set 변수를 만들었다. ㅋㅋ 그럼 초기화 될까. Run Run Run
[main.cpp]
|
당연히 Fail이다. 계속 이런식이다. ㅎㅎ 우리는 수정하면서 고치면된다. 고고
- Write a test that fails
- Make the code work
- Eliminate redundancy
[student.h]
|
[student.cpp]
|
F5를 눌러보자 아마 잘 돌꺼다. ㅋㅋㅋ
다음을 refactoring이다. 고고
- Write a test that fails
- Make the code work
- Eliminate redundancy
[student.h]
|
[student.cpp]
|
고고 이렇게 하면 refactoring 완료완료
Comments