DEV Community

Discussion on: Daily Challenge #157 - Is N Divisible by X and Y?

Collapse
nijeesh4all profile image
Nijeesh Joshy • Edited on

Ruby


require 'minitest'


def is_divisible(num, x, y)
  num % x == 0 && num % y == 0
end

class IsDivisibleTest < MiniTest::Test
  def test_is_divisible
    assert_equal true, is_divisible(12,4,3), "is_divisible(12,4,3) should return a boolean true"
    assert_equal false, is_divisible(100,4,3), "is_divisible(100,4,3) should return a boolean false"
    assert_equal true, is_divisible(0,4,3), "is_divisible(0,4,3) should return a boolean true"
    assert_equal false, is_divisible(10,0,3), "is_divisible(10,0,3) should return a boolean false"
  end
end

MiniTest.run