19 Commits

Author SHA1 Message Date
dearblue 12e90896a5 Moved tests for Integer#quo
The `Rational` class is never defined during core testing.
2025-01-26 21:11:21 +09:00
Yukihiro "Matz" Matsumoto 36eff3ec59 mruby-rational/test: remove UserDefinedNumeric tests
Since they checks the behavior different from CRuby.
2024-06-17 07:57:54 +09:00
Yukihiro "Matz" Matsumoto 019a2ddff4 mruby-rational/rational.c: implement Rational#**; close #5724 2022-06-21 16:53:17 +09:00
Yukihiro "Matz" Matsumoto c2f929ad0f Move default Integer#/ from rational.c to complex.c. 2021-03-27 12:38:16 +09:00
Yukihiro "Matz" Matsumoto 9492e389b8 rational.rb: add test for arithmetic operators.
Tests for (`Float` or `Integer`) `op` `Rational`.
2021-03-26 07:37:50 +09:00
dearblue 80fe9838d2 Integrate Fixnum class into Integer class
* The `Fixnum` constant is now an alias for the `Integer` class.
* Remove `struct mrb_state::fixnum_class` member.
  If necessary, use `struct mrb_state::integer_class` instead.
2020-10-12 16:21:44 +09:00
KOBAYASHI Shuji 44381f0a0c Refine message to skip in nested assert
- I think "Info" is used only to `skip`, so change to "Skip".
- Changed the default value of `assert` and specify the argument explicitly
  at the caller of `assert` because it is unnatural "Assertion failed" is
  output even though the assertion doesn't fail.

== Example:

  def assert_foo(exp, act)
    assert do
      assert_equal exp[0], act[0]
      assert_equal exp[1], act[1]
    end
  end

  def assert_bar(exp, act)
    assert do
      skip
    end
  end

  def assert_baz(exp, act)
    assert do
      assert_equal exp, act
      assert_bar exp, act
    end
  end

  assert 'test#skip_in_nested_assert' do
    assert_baz 1, 1
  end

  === Before this patch:

    ?..
    Info: test#skip_in_nested_assert (core)
     - Assertion[1]
        Info: Assertion failed (core)
         - Assertion[1-2]
            Skip: Assertion failed (core)
      Total: 3
         OK: 2
         KO: 0
      Crash: 0
    Warning: 0
       Skip: 1

  === After this patch:

    ???
    Skip: test#skip_in_nested_assert (core)
     - Assertion[1]
        Skip: assert (core)
         - Assertion[1-2]
            Skip: assert (core)
      Total: 3
         OK: 0
         KO: 0
      Crash: 0
    Warning: 0
       Skip: 3
2019-07-30 13:05:01 +09:00
dearblue a215292b6a Use nested assert 2019-06-29 11:54:17 +09:00
KOBAYASHI Shuji 902b2ce3c6 Fix Rational#==(Complex)
Consider a Numreic class like `Complex` that does not have `<=>` but `==`
works (`0i == 0r` is `true`).
2019-05-27 21:29:49 +09:00
KOBAYASHI Shuji 48903850e9 Freeze Rational and Complex objects 2019-05-23 13:40:49 +09:00
KOBAYASHI Shuji 8513abd404 Kernel#Rational requires numerator 2019-05-22 19:57:35 +09:00
KOBAYASHI Shuji 5d6c1794ad Revert part of #4457 2019-05-21 09:31:06 +09:00
KOBAYASHI Shuji 97600ded8d Change the order of "expected" and "actual" in mruby-rational test 2019-05-20 18:24:18 +09:00
KOBAYASHI Shuji a6eb01837b Fix Rational#<=>(Numeric)
Reported by Sergey Ukrainskiy: https://github.com/mruby/mruby/commit/f5fb1307b017fb972c12b4ec4b1866d789b0ca09#r33590698
2019-05-19 13:52:18 +09:00
KOBAYASHI Shuji aa41a5c9af Drop dependency from mruby-rational to mruby-numeric-ext 2019-05-17 20:44:48 +09:00
KOBAYASHI Shuji f5fb1307b0 Fix Rational#== 2019-05-16 22:09:56 +09:00
Ukrainskiy Sergey fa45cc4272 Fix dependencies 2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey d67d2ae8e8 Basic implementation of Complex and Rational classes 2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey 8808219e6d Initial suffix support 2019-05-15 16:57:21 +09:00