Yukihiro "Matz" Matsumoto
2ffb77586a
Symbolify saved alias name to improve performance.
2020-06-20 12:07:49 +09:00
Yukihiro "Matz" Matsumoto
3d2d9f8a9b
Add explicit cast to DROP_PRECISION macro in rtional.c.
2020-06-04 11:01:31 +09:00
Yukihiro "Matz" Matsumoto
6fe03f3b39
Add explicit cast to silence warnings on AppVeyor.
2020-06-04 11:01:30 +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
Yukihiro "Matz" Matsumoto
a57a9bce79
Call MRB_SET_INSTANCE_TT for Complex and Rational.
2019-07-24 10:48:00 +09:00
Yukihiro "Matz" Matsumoto
2a410c0e1b
Avoid making top-level env in initialization code; ref #4581
2019-07-18 00:34:08 +09:00
dearblue
a215292b6a
Use nested assert
2019-06-29 11:54:17 +09:00
dearblue
64b3d452ec
Drop precisions for rational when big numbers
2019-06-05 23:25:28 +09:00
dearblue
5e69760d91
Fix build error if struct mrb_rational is bigger than RIStruct
...
In that case, to be switched implementation with `RData`.
It is based to "complex".
2019-06-05 23:25:23 +09:00
Yukihiro "Matz" Matsumoto
855f2cdeea
Slightly simplify Rational#==; ref #4475
2019-05-29 11:49:21 +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
Yukihiro "Matz" Matsumoto
fccec8964a
Implements part of Complex class in C.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
b7f85b9df9
Should not refer Float class in case of MRB_WITHOUT_FLOAT.
...
This commit removes `Float` from `rational.c`.
2019-05-21 21:08:26 +09:00
KOBAYASHI Shuji
3b46831da8
Move **,/,quo,div and comparison methods to Integral from Numeric
...
Having these methods in Numeric can get in the way of creating subclasses of
Numeric because they only support Fixnum and Float.
2019-05-21 20:43:42 +09:00
KOBAYASHI Shuji
5d6c1794ad
Revert part of #4457
2019-05-21 09:31:06 +09:00
Yukihiro "Matz" Matsumoto
70e754e6da
Merge pull request #4457 from shuujii/change-the-order-of-expected-and-actual-in-mruby-rational-test
...
Change the order of "expected" and "actual" in `mruby-rational` test
2019-05-21 07:56:21 +09:00
KOBAYASHI Shuji
3db5d7fe3d
Drop dependency from mruby-rational to mruby-object-ext
2019-05-20 18:36:13 +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
6c9c189e4b
Move Object#(Rational|Complex) to Kernel
2019-05-18 18:31:55 +09:00
Yukihiro "Matz" Matsumoto
bd7328f5e6
Implement Rational._new in C.
2019-05-18 11:23:59 +09:00
Yukihiro "Matz" Matsumoto
ace0d3949b
Support MRB_WITHOUT_FLOAT.
...
I assume there's no realistic usage of `Rational` with
`MRB_WITHOUT_FLOAT`. But just for consistency.
2019-05-18 08:38:45 +09:00
Yukihiro "Matz" Matsumoto
eecac4f18b
Merge pull request #4442 from shuujii/drop-dependency-from-mruby-rational-to-mruby-numeric-ext
...
Drop dependency from `mruby-rational` to `mruby-numeric-ext`
2019-05-17 21:27:47 +09:00
KOBAYASHI Shuji
aa41a5c9af
Drop dependency from mruby-rational to mruby-numeric-ext
2019-05-17 20:44:48 +09:00
KOBAYASHI Shuji
eeb95e058a
Fix Numeric#to_r
2019-05-17 19:53:31 +09:00
Yukihiro "Matz" Matsumoto
b6e9fab649
Implement part of Rational in C.
2019-05-17 16:37:34 +09:00
Yukihiro "Matz" Matsumoto
cec92673ae
Avoid direct access to instance variables in rational.rb.
2019-05-17 16:22:23 +09:00
Yukihiro "Matz" Matsumoto
912d23634d
Fixed wrong overloading.
...
`float op rational` should return `float`, since float is an inexact
value.
2019-05-17 16:18:46 +09:00
Yukihiro "Matz" Matsumoto
0d61bcd823
Use div (integer divition) instead of / for rational numbers.
2019-05-17 11:27:52 +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