Problem statement

We will extend our example from the previous chapter about base conversion so that we can convert from decimal to hexadecimal and vice versa.

Feature – decimal to hexadecimal conversion

As a user, I want to convert a decimal number to a hexadecimal number.

Scenario 1:

  • Given a decimal number A
  • When I convert this number to a hexadecimal number
  • Then, I get a hexadecimal equivalent B of the original decimal number

Scenario 2:

  • Given a hexadecimal number X
  • When I convert this number to a decimal number
  • Then, I get decimal equivalent Y of the original hexadecimal number

Scenario 3:

  • Given a decimal number A
  • When I convert A to hexadecimal to get hexadecimal number B
  • And I again convert B to decimal number C
  • Then, A is equal to C

Let's apply some ...

Get Scala Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.