summaryrefslogtreecommitdiff
path: root/test/bigdecimal/helper.rb
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2021-10-27 17:31:45 +0900
committerKenta Murata <mrkn@mrkn.jp>2021-12-24 02:28:54 +0900
commitb2a74948b6fe60727235b80ab56b4c701c315aa3 (patch)
treeec1d4e73b8bd6278b0529160ee33f0994a992aaf /test/bigdecimal/helper.rb
parented7f4c24d73333a716ce7944a465f430a7f7f910 (diff)
[ruby/bigdecimal] Add tests for the issue GH-192
https://github.com/ruby/bigdecimal/commit/e864828b47
Diffstat (limited to 'test/bigdecimal/helper.rb')
-rw-r--r--test/bigdecimal/helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/bigdecimal/helper.rb b/test/bigdecimal/helper.rb
index 22b05f09ae..46721fb9a8 100644
--- a/test/bigdecimal/helper.rb
+++ b/test/bigdecimal/helper.rb
@@ -1,8 +1,19 @@
# frozen_string_literal: false
require "test/unit"
require "bigdecimal"
+require 'rbconfig/sizeof'
module TestBigDecimalBase
+ if RbConfig::SIZEOF.key?("int64_t")
+ SIZEOF_DECDIG = RbConfig::SIZEOF["int32_t"]
+ BASE = 1_000_000_000
+ BASE_FIG = 9
+ else
+ SIZEOF_DECDIG = RbConfig::SIZEOF["int16_t"]
+ BASE = 1000
+ BASE_FIG = 4
+ end
+
def setup
@mode = BigDecimal.mode(BigDecimal::EXCEPTION_ALL)
BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true)