**テスト駆動開発(TDD)**は、コードの前にテストを書くプラクティスです。短い反復サイクル(失敗するテストを書く、それを通すコードを書く、リファクタリングする)に従うもので、テストによって設計を駆動し、コードがテスト可能でよくテストされていることを保証します。
TDDサイクル:Red、Green、Refactor
1. RED → write a FAILING test for the behavior you want (it fails — the code doesn't exist yet)
2. GREEN → write the MINIMUM code to make the test PASS (just enough, don't over-build)
3. REFACTOR → improve/clean up the code (and tests) while keeping tests GREEN
→ Repeat this short cycle for each small piece of behavior.
Write test (RED) → write code (GREEN) → clean up (REFACTOR) → repeat
実行フロー例
(, ((, )).());
() { a + b; }
