Test-Driven Development
This lesson explains a software development methodology that focuses on unit testing.
We'll cover the following...
Test-driven development
Test-driven development (TDD) is a software development methodology that prescribes writing unit tests before implementing functionality. In TDD, the focus is on unit testing. Coding is a secondary activity that makes the tests pass.
In accordance with TDD, the ordinal() function below can first be implemented intentionally incorrectly:
D
import std.string;string ordinal(size_t number) {return ""; // β intentionally wrong}unittest {assert(ordinal(1) == "1st");assert(ordinal(2) == "2nd");assert(ordinal(3) == "3rd");assert(ordinal(10) == "10th");}void main() {}
The function should ...