Ad
  • Default User Avatar

    Sample tests should include case where numbers are diffent, but they're both either odd or even.
    For instance Ruby:
    Test.assert_equals(lovefunc(7,5), false)
    or
    Test.assert_equals(lovefunc(6,8), false)

    Sample tests are passable with simple "value1 != value2", although they obviously fails the attempt and they would also fail if any of two examples above would be added.

  • Custom User Avatar

    If the score < 0, return 0

  • Default User Avatar

    Ah, I never seen on CodeWars sample tests that wouldn't work, so somehow I didn't even dare to attempt without passing sample tests, but my code of course worked when I used it to pass the challenge.

  • Default User Avatar

    This kata does not have Sample Tests in Ruby. There is an issue posted about this. There is just some boilerplate code instead.

  • Default User Avatar

    I didn't use method "add" in my code so why am I getting error "undefined methord add"?

  • Default User Avatar

    that's from your own code though?

  • Default User Avatar

    It seems like tests in Ruby are not working correctly? My code works in REPL(IRB) and I checked Ruby documentation for 2.5.0 that includes code I've used. So following error message seems to come from incorrect tests - "undefined method 'add'"?

    #<NoMethodError: undefined method add' for main:Object> main.rb:12:in block (2 levels) in '
    /runner/frameworks/ruby/cw-2.rb:180:in wrap_error' /runner/frameworks/ruby/cw-2.rb:72:in it'
    /runner/frameworks/ruby/cw-2.rb:206:in it' main.rb:11:in block in '
    /runner/frameworks/ruby/cw-2.rb:55:in block in describe' /runner/frameworks/ruby/cw-2.rb:46:in measure'
    /runner/frameworks/ruby/cw-2.rb:51:in describe' /runner/frameworks/ruby/cw-2.rb:202:in describe'
    main.rb:10:in `'

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution