/sundial

[javascript, quick, tdd]

Primary LanguageJavaScript

Clock Hands: TDD Edition

Write a function that given the time of the day in hours and minutes returns the angle between the hands on a clock.

You must take a TDD approach to this assignment. Create a test before writing the corresponding code.

  • You must implement at least three different tests.
  • Think about the different cases your function will need to handle. Create a test for each of them.

Notes:

  • It should give a positive angle and return the smaller one (ie less than 180 degrees).
  • You can assume that the clock only moves once each minute on the minute to update its hands.