1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fiddle/import.rb: fix typo

* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
  SIZEOF_LONG_LON.  [Fix GH-714]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-09-15 00:43:14 +00:00
parent 80f431990c
commit 065b6d2b7c
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Sep 15 09:43:18 2014 Sho Hashimoto <sho.hsmt@gmail.com>
* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
SIZEOF_LONG_LON. [Fix GH-714]
Mon Sep 15 08:13:40 2014 Matthew Draper <matthew@trebex.net>
* sprintf.c (rb_str_format): rational 'f' format works for more

View file

@ -112,7 +112,7 @@ module Fiddle
when TYPE_LONG
return SIZEOF_LONG
when TYPE_LONG_LONG
return SIZEOF_LONG_LON
return SIZEOF_LONG_LONG
when TYPE_FLOAT
return SIZEOF_FLOAT
when TYPE_DOUBLE

View file

@ -65,6 +65,15 @@ module Fiddle
assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct.malloc()))
end
Fiddle.constants.grep(/\ATYPE_(?!VOID\z)(.*)/) do
type = $&
size = Fiddle.const_get("SIZEOF_#{$1}")
name = $1.sub(/P\z/,"*").gsub(/_(?!T\z)/, " ").downcase
define_method("test_sizeof_#{name}") do
assert_equal(size, Fiddle::Importer.sizeof(name), type)
end
end
def test_unsigned_result()
d = (2 ** 31) + 1