# Example : Simple Calculator --- ## Description: Develop a basic calculator that can add and subtract numbers. --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div> <br><br><br><br><br><br><br><br> ---- ## Code ![](https://hackmd.io/_uploads/rJ610aJ2n.png) <br><br> --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px; color: red;">2. Implement the minimal code required to make the test pass.</div > <br><br><br><br><br><br><br> ---- ## Code ![](https://hackmd.io/_uploads/B1ifApkh3.png) <br><br><br><br><br><br> ---- ## Code ![](https://hackmd.io/_uploads/rJXwRpJnn.png) <br><br> ---- ## Run test ![](https://hackmd.io/_uploads/H1riC6kn2.png) <br><br><br><br><br> --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">2. Implement the minimal code required to make the test pass.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;color: red;">3. Refactor the code if necessary.</div > <br><br><br><br><br> --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">2. Implement the minimal code required to make the test pass.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">3. Refactor the code if necessary.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;color: red;">4. Write a failing test case to verify that the calculator can correctly subtract two numbers.</div > <br><br><br><br><br> ---- ## Code ![](https://hackmd.io/_uploads/ByugJRkh2.png) --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">2. Implement the minimal code required to make the test pass.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">3. Refactor the code if necessary.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">4. Write a failing test case to verify that the calculator can correctly subtract two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;color: red;">5. Implement the code to make the test pass.</div > <br><br><br><br> ---- ## Code ![](https://hackmd.io/_uploads/r1T7yAk3h.png) <br><br><br> ---- ## Result ![](https://hackmd.io/_uploads/B1zDyC1nh.png) <br><br><br><br><br> --- ## Steps: <div style="font-size: 25px;display: block; margin-bottom: 20px;">1. Write a failing test case to verify that the calculator can correctly add two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">2. Implement the minimal code required to make the test pass.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">3. Refactor the code if necessary.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">4. Write a failing test case to verify that the calculator can correctly subtract two numbers.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;">5. Implement the code to make the test pass.</div > <div style="font-size: 25px;display: block; margin-bottom: 20px;color: red;">6. Refactor the code if necessary.</div > <br><br><br>
{"title":"TDD example(ptt)","description":"<!-- .element: class=\"fragment\" data-fragment-index=\"1\" -->","contributors":"[{\"id\":\"e5b88119-7376-4048-868a-ae5c43f8973e\",\"add\":7029,\"del\":3134}]"}
    322 views