October 2016
Intermediate to advanced
198 pages
3h 52m
English
If you remember form the TDD testing cycle, we had RED-GREEN-REFACTOR-REPEAT. We are not at a stage where we can refactor our code, as there is not enough of it yet. So, we skip this step and move to REPEAT, that is, writing more failing tests and then writing application code to fix them. Some of the tests may seem to have overlapping boundaries, but we will leave them be for now.
Let's fill in our pending tests one at a time:
it should "convert a number 245 into a binary number 11110101" in
{
val binary:Binary = BaseConversion.decimalToBinary(Decimal("245"))
assert(binary.number == "11110101")
}Now we are at a point where we need a more generic conversion algorithm for decimal to binary. So we will start writing our implementation. ...
Read now
Unlock full access