@@ -2565,53 +2565,6 @@ def test_bsearch_for_bigdecimal
2565
2565
}
2566
2566
end
2567
2567
2568
- def test_gc_compaction_safe
2569
- omit if RUBY_VERSION < "3.2" || RUBY_ENGINE == "truffleruby"
2570
-
2571
- assert_separately ( [ "-rbigdecimal" ] , "#{ <<~"begin;" } \n #{ <<~'end;' } " )
2572
- begin;
2573
- x = 1.5
2574
- y = 0.5
2575
- nan = BigDecimal("NaN")
2576
- inf = BigDecimal("Infinity")
2577
- bx = BigDecimal(x.to_s)
2578
- by = BigDecimal(y.to_s)
2579
- GC.verify_compaction_references(expand_heap: true, toward: :empty)
2580
-
2581
- assert_in_delta(x + y, bx + by)
2582
- assert_in_delta(x + y, bx.add(by, 10))
2583
- assert_in_delta(x - y, bx - by)
2584
- assert_in_delta(x - y, bx.sub(by, 10))
2585
- assert_in_delta(x * y, bx * by)
2586
- assert_in_delta(x * y, bx.mult(by, 10))
2587
- assert_in_delta(x / y, bx / by)
2588
- assert_in_delta(x / y, bx.div(by, 10))
2589
- assert_in_delta((x / y).floor, bx.div(by))
2590
- assert_in_delta(x % y, bx % by)
2591
- assert_in_delta(Math.sqrt(x), bx.sqrt(10))
2592
- assert_equal(x.div(y), bx.div(by))
2593
- assert_equal(x.remainder(y), bx.remainder(by))
2594
- assert_equal(x.divmod(y), bx.divmod(by))
2595
- assert_equal([0, x], bx.divmod(inf))
2596
- assert_in_delta(x, bx.remainder(inf))
2597
- assert((nan + nan).nan?)
2598
- assert((nan - nan).nan?)
2599
- assert((nan * nan).nan?)
2600
- assert((nan / nan).nan?)
2601
- assert((nan % nan).nan?)
2602
- assert((inf + inf).infinite?)
2603
- assert((inf - inf).nan?)
2604
- assert((inf * inf).infinite?)
2605
- assert((inf / inf).nan?)
2606
- assert((inf % inf).nan?)
2607
- assert_in_delta(Math.exp(x), BigMath.exp(bx, 10))
2608
- assert_in_delta(x**y, bx**by)
2609
- assert_in_delta(x**y, bx.power(by, 10))
2610
- assert_in_delta(Math.exp(x), BigMath.exp(bx, 10))
2611
- assert_in_delta(Math.log(x), BigMath.log(bx, 10))
2612
- end;
2613
- end
2614
-
2615
2568
def assert_no_memory_leak ( code , *rest , **opt )
2616
2569
code = "8.times {20_000.times {begin #{ code } ; rescue NoMemoryError; end}; GC.start}"
2617
2570
paths = $LOAD_PATH. map { |path | "-I#{ path } " }
0 commit comments