7 kyu

Color of the moment

235 of 339keune
Description
Loading description...
Strings
Fundamentals
  • Please sign in or sign up to leave a comment.
  • VanoKi Avatar

    Please help, what type of error should i output in case the time is not in the correct format?

  • hobovsky Avatar

    In C# version:

    Test Failed
      Thats not a valid time!
      Expected: <System.Exception>
      But was:  <System.ArgumentException: Invalid time>
    

    If tests expect instance of exactly System.Exception to be thrown (and that's bad, BTW), it should be mentioned in the description.

  • HerrWert Avatar

    Using hours, minutes, and seconds to correspond to R, G, and B -- as I assume you intended -- it would be cool to see how this clock's colours change over the course of the day. It would be easy to code, too! I suppose they'd be rather dark colours, given the constraints for valid h/m/s values. But dark colours are good for a clock background. Maybe I'll go try that...

  • user5036852 Avatar

    Perhaps add a hint, that the time is allowed as 00:00:00 - 23:59:59.

  • brunolm Avatar

    Please add these two test cases

    Test.expectError('Thats not a valid time!', function() {hexToTime('#0d373c')}); // '13:55:60'
    Test.expectError('Thats not a valid time!', function() {hexToTime('#0d3c37')}); // '13:60:55'
    

    It is validating the hour correctly up to 23 (maybe it was a random one, maybe it is best to create one for it too), but tests are not checking the range for minutes and seconds up to 59.

    • brunolm Avatar

      I've added these three tests:

      Test.expectError('Thats not a valid time!', function() {hexToTime('#183737')}); // '24:55:55'
      Test.expectError('Thats not a valid time!', function() {hexToTime('#0d373c')}); // '13:55:60'
      Test.expectError('Thats not a valid time!', function() {hexToTime('#0d3c37')}); // '13:60:55'
      

      Great Kata :)

      Issue marked resolved by brunolm 9 years ago
    • keune Avatar

      thanks :)

  • mcelearr Avatar

    Nice kata. Wrapped up some programming fundamentals in a well-explained and interesting puzzle.

  • kayahr Avatar

    Confusing test cases. The real ones expect an exception while the provided ones only works when I return the error message instead of throwing it. Or was that a part of the Kata? Repairing the provided unit tests?