diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-07-22 23:07:45 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-07-22 23:07:45 +0900 |
| commit | 3de8c4441e7c6345ae35a818ff0213db549849f3 (patch) | |
| tree | 63131a71fc01d2df0e1d8ccce01cb1ee8fb84d10 | |
| parent | 6ada0df27ec557c343ffa22dee8ba43211f51a0f (diff) | |
| parent | 1b9708ef830a7c662940412ea4b0c8e406ee8d1e (diff) | |
| download | mruby-3de8c4441e7c6345ae35a818ff0213db549849f3.tar.gz mruby-3de8c4441e7c6345ae35a818ff0213db549849f3.zip | |
Merge branch 'master' of github.com:mruby/mruby
| -rw-r--r-- | src/class.c | 1 | ||||
| -rw-r--r-- | src/state.c | 2 | ||||
| -rw-r--r-- | test/t/float.rb | 30 |
3 files changed, 25 insertions, 8 deletions
diff --git a/src/class.c b/src/class.c index 38eb5ea1f..b8532cdcc 100644 --- a/src/class.c +++ b/src/class.c @@ -115,7 +115,6 @@ mrb_define_module_id(mrb_state *mrb, mrb_sym name) { struct RClass *m = mrb_module_new(mrb); - m->mt = kh_init(mt, mrb); mrb_obj_iv_set(mrb, (struct RObject*)mrb->object_class, name, mrb_obj_value(m)); mrb_name_class(mrb, m, name); diff --git a/src/state.c b/src/state.c index 7f74606ff..0d236e660 100644 --- a/src/state.c +++ b/src/state.c @@ -83,7 +83,7 @@ mrb_add_irep(mrb_state *mrb, int idx) while (mrb->irep_capa <= idx) { mrb->irep_capa *= 2; } - mrb->irep = mrb_realloc(mrb, mrb->irep, sizeof(mrb_irep)*mrb->irep_capa); + mrb->irep = mrb_realloc(mrb, mrb->irep, sizeof(mrb_irep*)*mrb->irep_capa); } } diff --git a/test/t/float.rb b/test/t/float.rb index 5c5245c73..30b470272 100644 --- a/test/t/float.rb +++ b/test/t/float.rb @@ -65,7 +65,11 @@ assert('Float#==', '15.2.9.3.7') do end assert('Float#ceil', '15.2.9.3.8') do - 3.123456789.ceil == 4 + a = 3.123456789.ceil + b = 3.0.ceil + c = -3.123456789.ceil + d = -3.0.ceil + a == 4 and b == 3 and c == -3 and d == -3 end assert('Float#finite?', '15.2.9.3.9') do @@ -74,20 +78,34 @@ assert('Float#finite?', '15.2.9.3.9') do end assert('Float#floor', '15.2.9.3.10') do - 3.123456789.floor == 3 + a = 3.123456789.floor + b = 3.0.floor + c = -3.123456789.floor + d = -3.0.floor + a == 3 and b == 3 and c == -4 and d == -3 end assert('Float#infinite?', '15.2.9.3.11') do - not 3.123456789.infinite? and - (1.0 / 0.0).infinite? + a = 3.123456789.infinite? + b = (1.0 / 0.0).infinite? + c = (-1.0 / 0.0).infinite? + + a == nil and b == 1 and c == -1 end assert('Float#round', '15.2.9.3.12') do a = 3.123456789.round b = 3.5.round c = 3.499999999.round + d = (-3.123456789).round + e = (-3.5).round + f = 12345.67.round(-1) + g = 3.123456789.round(0) + h = 3.123456789.round(1) + i = 3.123456789.round(4) - a == 3 and b == 4 and c == 3 + a == 3 and b == 4 and c == 3 and d == -3 and e == -4 and + f == 12350 and g == 3 and h == 3.1 and i == 3.1235 end assert('Float#to_f', '15.2.9.3.13') do @@ -101,5 +119,5 @@ assert('Float#to_i', '15.2.9.3.14') do end assert('Float#truncate', '15.2.9.3.15') do - 3.123456789.truncate == 3 + 3.123456789.truncate == 3 and -3.1.truncate == -3 end |
