windows-pr 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +408 -404
- data/MANIFEST +65 -65
- data/README +149 -149
- data/Rakefile +52 -52
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +59 -59
- data/lib/windows/com.rb +190 -189
- data/lib/windows/com/automation.rb +147 -147
- data/lib/windows/com/variant.rb +22 -22
- data/lib/windows/console.rb +112 -112
- data/lib/windows/debug.rb +33 -33
- data/lib/windows/device_io.rb +246 -246
- data/lib/windows/directory.rb +25 -25
- data/lib/windows/error.rb +482 -482
- data/lib/windows/eventlog.rb +78 -78
- data/lib/windows/file.rb +262 -262
- data/lib/windows/file_mapping.rb +23 -23
- data/lib/windows/filesystem.rb +13 -13
- data/lib/windows/gdi/bitmap.rb +63 -63
- data/lib/windows/gdi/device_context.rb +44 -44
- data/lib/windows/gdi/metafile.rb +38 -38
- data/lib/windows/gdi/painting_drawing.rb +113 -113
- data/lib/windows/handle.rb +21 -21
- data/lib/windows/library.rb +42 -42
- data/lib/windows/limits.rb +31 -31
- data/lib/windows/mailslot.rb +22 -22
- data/lib/windows/memory.rb +126 -126
- data/lib/windows/msvcrt/buffer.rb +73 -73
- data/lib/windows/msvcrt/directory.rb +29 -29
- data/lib/windows/msvcrt/file.rb +45 -45
- data/lib/windows/msvcrt/io.rb +71 -71
- data/lib/windows/msvcrt/time.rb +167 -167
- data/lib/windows/national.rb +578 -578
- data/lib/windows/network/management.rb +523 -523
- data/lib/windows/network/snmp.rb +90 -90
- data/lib/windows/network/winsock.rb +126 -126
- data/lib/windows/nio.rb +48 -47
- data/lib/windows/ntfs/winternl.rb +96 -96
- data/lib/windows/path.rb +141 -141
- data/lib/windows/pipe.rb +40 -40
- data/lib/windows/process.rb +174 -174
- data/lib/windows/registry.rb +126 -126
- data/lib/windows/security.rb +477 -477
- data/lib/windows/security/authentication.rb +30 -30
- data/lib/windows/service.rb +140 -140
- data/lib/windows/shell.rb +169 -169
- data/lib/windows/sound.rb +37 -37
- data/lib/windows/synchronize.rb +131 -131
- data/lib/windows/system_info.rb +227 -222
- data/lib/windows/thread.rb +62 -62
- data/lib/windows/time.rb +46 -46
- data/lib/windows/tool_helper.rb +34 -34
- data/lib/windows/volume.rb +59 -59
- data/lib/windows/window.rb +79 -79
- data/lib/windows/window/classes.rb +57 -57
- data/lib/windows/window/dialog.rb +89 -89
- data/lib/windows/window/menu.rb +100 -100
- data/lib/windows/window/message.rb +295 -295
- data/lib/windows/window/properties.rb +18 -18
- data/lib/windows/window/timer.rb +17 -17
- data/test/tc_clipboard.rb +41 -41
- data/test/tc_com.rb +32 -32
- data/test/tc_com_automation.rb +15 -15
- data/test/tc_console.rb +108 -108
- data/test/tc_debug.rb +48 -48
- data/test/tc_device_io.rb +29 -29
- data/test/tc_directory.rb +25 -25
- data/test/tc_error.rb +49 -49
- data/test/tc_eventlog.rb +58 -58
- data/test/tc_file.rb +67 -67
- data/test/tc_file_mapping.rb +38 -38
- data/test/tc_filesystem.rb +27 -27
- data/test/tc_gdi_bitmap.rb +25 -25
- data/test/tc_gdi_metafile.rb +23 -23
- data/test/tc_handle.rb +36 -36
- data/test/tc_library.rb +37 -37
- data/test/tc_limits.rb +34 -34
- data/test/tc_mailslot.rb +22 -22
- data/test/tc_memory.rb +44 -44
- data/test/tc_msvcrt_buffer.rb +68 -68
- data/test/tc_msvcrt_directory.rb +98 -98
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +93 -93
- data/test/tc_msvcrt_time.rb +29 -29
- data/test/tc_national.rb +38 -38
- data/test/tc_network_management.rb +32 -32
- data/test/tc_network_snmp.rb +31 -31
- data/test/tc_network_winsock.rb +34 -34
- data/test/tc_nio.rb +32 -32
- data/test/tc_ntfs_winternl.rb +29 -29
- data/test/tc_path.rb +90 -90
- data/test/tc_pipe.rb +53 -53
- data/test/tc_process.rb +24 -24
- data/test/tc_registry.rb +29 -29
- data/test/tc_security.rb +104 -104
- data/test/tc_security_authentication.rb +34 -34
- data/test/tc_service.rb +57 -57
- data/test/tc_shell.rb +34 -34
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +43 -43
- data/test/tc_thread.rb +29 -29
- data/test/tc_time.rb +32 -32
- data/test/tc_tool_helper.rb +29 -29
- data/test/tc_volume.rb +47 -47
- data/test/tc_window.rb +45 -45
- data/test/tc_window_classes.rb +33 -33
- data/test/tc_window_dialog.rb +33 -33
- data/test/tc_window_menu.rb +29 -29
- data/test/tc_window_message.rb +33 -33
- data/test/tc_window_properties.rb +29 -29
- data/test/tc_window_timer.rb +29 -29
- data/windows-pr.gemspec +34 -34
- metadata +4 -4
data/test/tc_msvcrt_file.rb
CHANGED
@@ -1,80 +1,80 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_msvcrt_file.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::MSVCRT::File module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/msvcrt/file'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class MFileFoo
|
10
|
-
include Windows::MSVCRT::File
|
11
|
-
end
|
12
|
-
|
13
|
-
class TC_Windows_MSVCRT_File < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@foo = MFileFoo.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_numeric_constants
|
19
|
-
assert_not_nil(MFileFoo::S_IFMT)
|
20
|
-
assert_not_nil(MFileFoo::S_IFDIR)
|
21
|
-
assert_not_nil(MFileFoo::S_IFCHR)
|
22
|
-
assert_not_nil(MFileFoo::S_IFIFO)
|
23
|
-
assert_not_nil(MFileFoo::S_IFREG)
|
24
|
-
assert_not_nil(MFileFoo::S_IREAD)
|
25
|
-
assert_not_nil(MFileFoo::S_IWRITE)
|
26
|
-
assert_not_nil(MFileFoo::S_IEXEC)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_method_constants
|
30
|
-
assert_not_nil(MFileFoo::Chmod)
|
31
|
-
assert_not_nil(MFileFoo::Chsize)
|
32
|
-
assert_not_nil(MFileFoo::Mktemp)
|
33
|
-
assert_not_nil(MFileFoo::Stat)
|
34
|
-
assert_not_nil(MFileFoo::Stat64)
|
35
|
-
assert_not_nil(MFileFoo::Wchmod)
|
36
|
-
assert_not_nil(MFileFoo::Wmktemp)
|
37
|
-
assert_not_nil(MFileFoo::Wstat)
|
38
|
-
assert_not_nil(MFileFoo::Wstat64)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_chmod
|
42
|
-
assert_respond_to(@foo, :chmod)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_chsize
|
46
|
-
assert_respond_to(@foo, :chsize)
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_mktemp
|
50
|
-
assert_respond_to(@foo, :mktemp)
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_stat
|
54
|
-
assert_respond_to(@foo, :stat)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_stat64
|
58
|
-
assert_respond_to(@foo, :stat64)
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_wchmod
|
62
|
-
assert_respond_to(@foo, :wchmod)
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_wmktemp
|
66
|
-
assert_respond_to(@foo, :wmktemp)
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_wstat
|
70
|
-
assert_respond_to(@foo, :wstat)
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_wstat64
|
74
|
-
assert_respond_to(@foo, :wstat64)
|
75
|
-
end
|
76
|
-
|
77
|
-
def teardown
|
78
|
-
@foo = nil
|
79
|
-
end
|
80
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_msvcrt_file.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::MSVCRT::File module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/msvcrt/file'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class MFileFoo
|
10
|
+
include Windows::MSVCRT::File
|
11
|
+
end
|
12
|
+
|
13
|
+
class TC_Windows_MSVCRT_File < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@foo = MFileFoo.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_numeric_constants
|
19
|
+
assert_not_nil(MFileFoo::S_IFMT)
|
20
|
+
assert_not_nil(MFileFoo::S_IFDIR)
|
21
|
+
assert_not_nil(MFileFoo::S_IFCHR)
|
22
|
+
assert_not_nil(MFileFoo::S_IFIFO)
|
23
|
+
assert_not_nil(MFileFoo::S_IFREG)
|
24
|
+
assert_not_nil(MFileFoo::S_IREAD)
|
25
|
+
assert_not_nil(MFileFoo::S_IWRITE)
|
26
|
+
assert_not_nil(MFileFoo::S_IEXEC)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_method_constants
|
30
|
+
assert_not_nil(MFileFoo::Chmod)
|
31
|
+
assert_not_nil(MFileFoo::Chsize)
|
32
|
+
assert_not_nil(MFileFoo::Mktemp)
|
33
|
+
assert_not_nil(MFileFoo::Stat)
|
34
|
+
assert_not_nil(MFileFoo::Stat64)
|
35
|
+
assert_not_nil(MFileFoo::Wchmod)
|
36
|
+
assert_not_nil(MFileFoo::Wmktemp)
|
37
|
+
assert_not_nil(MFileFoo::Wstat)
|
38
|
+
assert_not_nil(MFileFoo::Wstat64)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_chmod
|
42
|
+
assert_respond_to(@foo, :chmod)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_chsize
|
46
|
+
assert_respond_to(@foo, :chsize)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_mktemp
|
50
|
+
assert_respond_to(@foo, :mktemp)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_stat
|
54
|
+
assert_respond_to(@foo, :stat)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_stat64
|
58
|
+
assert_respond_to(@foo, :stat64)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_wchmod
|
62
|
+
assert_respond_to(@foo, :wchmod)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_wmktemp
|
66
|
+
assert_respond_to(@foo, :wmktemp)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_wstat
|
70
|
+
assert_respond_to(@foo, :wstat)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_wstat64
|
74
|
+
assert_respond_to(@foo, :wstat64)
|
75
|
+
end
|
76
|
+
|
77
|
+
def teardown
|
78
|
+
@foo = nil
|
79
|
+
end
|
80
|
+
end
|
data/test/tc_msvcrt_io.rb
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_msvcrt_io.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::MSVCRT::IO module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/msvcrt/io'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class MIOFoo
|
10
|
-
include Windows::MSVCRT::IO
|
11
|
-
end
|
12
|
-
|
13
|
-
class TC_Windows_MSVCRT_IO < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@foo = MIOFoo.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_numeric_constants
|
19
|
-
assert_not_nil(MIOFoo::S_IFMT)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_method_constants
|
23
|
-
assert_not_nil(MIOFoo::Clearerr)
|
24
|
-
assert_not_nil(MIOFoo::Close)
|
25
|
-
assert_not_nil(MIOFoo::Fclose)
|
26
|
-
assert_not_nil(MIOFoo::Fileno)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_clearerr
|
30
|
-
assert_respond_to(@foo, :clearerr)
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_close
|
34
|
-
assert_respond_to(@foo, :close)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_fclose
|
38
|
-
assert_respond_to(@foo, :fclose)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_fileno
|
42
|
-
assert_respond_to(@foo, :fileno)
|
43
|
-
end
|
44
|
-
|
45
|
-
def teardown
|
46
|
-
@foo = nil
|
47
|
-
end
|
48
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_msvcrt_io.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::MSVCRT::IO module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/msvcrt/io'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class MIOFoo
|
10
|
+
include Windows::MSVCRT::IO
|
11
|
+
end
|
12
|
+
|
13
|
+
class TC_Windows_MSVCRT_IO < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@foo = MIOFoo.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_numeric_constants
|
19
|
+
assert_not_nil(MIOFoo::S_IFMT)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_method_constants
|
23
|
+
assert_not_nil(MIOFoo::Clearerr)
|
24
|
+
assert_not_nil(MIOFoo::Close)
|
25
|
+
assert_not_nil(MIOFoo::Fclose)
|
26
|
+
assert_not_nil(MIOFoo::Fileno)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_clearerr
|
30
|
+
assert_respond_to(@foo, :clearerr)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_close
|
34
|
+
assert_respond_to(@foo, :close)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_fclose
|
38
|
+
assert_respond_to(@foo, :fclose)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_fileno
|
42
|
+
assert_respond_to(@foo, :fileno)
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown
|
46
|
+
@foo = nil
|
47
|
+
end
|
48
|
+
end
|
data/test/tc_msvcrt_string.rb
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_msvcrt_string.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::MSVCRT::String module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/msvcrt/string'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class TC_Windows_MSVCRT_String < Test::Unit::TestCase
|
10
|
-
include Windows::MSVCRT::String
|
11
|
-
|
12
|
-
def setup
|
13
|
-
@buf = 0.chr * 260
|
14
|
-
@str = 'hello'
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_method_constants
|
18
|
-
assert_not_nil(Strcmp)
|
19
|
-
assert_not_nil(Strcpy)
|
20
|
-
assert_not_nil(Strcspn)
|
21
|
-
assert_not_nil(Strlen)
|
22
|
-
assert_not_nil(Strncpy)
|
23
|
-
assert_not_nil(Strrchr)
|
24
|
-
assert_not_nil(Strrev)
|
25
|
-
assert_not_nil(Strtok)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_strchr
|
29
|
-
assert_respond_to(self, :strchr)
|
30
|
-
assert_equal('llo', strchr('hello', 108))
|
31
|
-
assert_equal(nil, strchr('hello', 120))
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_strchr_with_zero
|
35
|
-
assert_nil(strchr(0, 'l'[0]))
|
36
|
-
assert_nil(strchr('hello', 0))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_strchr_expected_errors
|
40
|
-
assert_raise(ArgumentError){ strchr }
|
41
|
-
assert_raise(ArgumentError){ strchr('hello') }
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_strcmp
|
45
|
-
assert_respond_to(self, :strcmp)
|
46
|
-
assert_equal(-1, strcmp('alpha', 'beta'))
|
47
|
-
assert_equal(1, strcmp('beta', 'alpha'))
|
48
|
-
assert_equal(0, strcmp('alpha', 'alpha'))
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_strcmp_expected_errors
|
52
|
-
assert_raise(ArgumentError){ strcmp }
|
53
|
-
assert_raise(ArgumentError){ strcmp('alpha') }
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_strcpy
|
57
|
-
assert_respond_to(self, :strcpy)
|
58
|
-
assert_kind_of(Fixnum, strcpy(@buf, ['hello'].pack('p*').unpack('L')[0]))
|
59
|
-
assert_equal('hello', @buf.strip)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_strcspn
|
63
|
-
assert_respond_to(self, :strcspn)
|
64
|
-
assert_equal(3, strcspn('abcxyz123', '&^(x'))
|
65
|
-
assert_equal(9, strcspn('abcxyz123', '&^(('))
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_strcspn_expected_errors
|
69
|
-
assert_raise(ArgumentError){ strcspn }
|
70
|
-
assert_raise(ArgumentError){ strcspn('alpha') }
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_strlen
|
74
|
-
assert_respond_to(self, :strlen)
|
75
|
-
assert_equal(5, strlen('hello'))
|
76
|
-
assert_equal(0, strlen(''))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_strlen_expected_errors
|
80
|
-
assert_raise(ArgumentError){ strlen }
|
81
|
-
assert_raise(ArgumentError){ strlen('a', 'b') }
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_strncpy
|
85
|
-
assert_respond_to(self, :strncpy)
|
86
|
-
assert_equal('alp', strncpy(@buf, 'alpha', 3))
|
87
|
-
assert_equal('alp', @buf.strip)
|
88
|
-
end
|
89
|
-
|
90
|
-
def teardown
|
91
|
-
@buf = nil
|
92
|
-
end
|
93
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_msvcrt_string.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::MSVCRT::String module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/msvcrt/string'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TC_Windows_MSVCRT_String < Test::Unit::TestCase
|
10
|
+
include Windows::MSVCRT::String
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@buf = 0.chr * 260
|
14
|
+
@str = 'hello'
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_method_constants
|
18
|
+
assert_not_nil(Strcmp)
|
19
|
+
assert_not_nil(Strcpy)
|
20
|
+
assert_not_nil(Strcspn)
|
21
|
+
assert_not_nil(Strlen)
|
22
|
+
assert_not_nil(Strncpy)
|
23
|
+
assert_not_nil(Strrchr)
|
24
|
+
assert_not_nil(Strrev)
|
25
|
+
assert_not_nil(Strtok)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_strchr
|
29
|
+
assert_respond_to(self, :strchr)
|
30
|
+
assert_equal('llo', strchr('hello', 108))
|
31
|
+
assert_equal(nil, strchr('hello', 120))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_strchr_with_zero
|
35
|
+
assert_nil(strchr(0, 'l'[0]))
|
36
|
+
assert_nil(strchr('hello', 0))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_strchr_expected_errors
|
40
|
+
assert_raise(ArgumentError){ strchr }
|
41
|
+
assert_raise(ArgumentError){ strchr('hello') }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_strcmp
|
45
|
+
assert_respond_to(self, :strcmp)
|
46
|
+
assert_equal(-1, strcmp('alpha', 'beta'))
|
47
|
+
assert_equal(1, strcmp('beta', 'alpha'))
|
48
|
+
assert_equal(0, strcmp('alpha', 'alpha'))
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_strcmp_expected_errors
|
52
|
+
assert_raise(ArgumentError){ strcmp }
|
53
|
+
assert_raise(ArgumentError){ strcmp('alpha') }
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_strcpy
|
57
|
+
assert_respond_to(self, :strcpy)
|
58
|
+
assert_kind_of(Fixnum, strcpy(@buf, ['hello'].pack('p*').unpack('L')[0]))
|
59
|
+
assert_equal('hello', @buf.strip)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_strcspn
|
63
|
+
assert_respond_to(self, :strcspn)
|
64
|
+
assert_equal(3, strcspn('abcxyz123', '&^(x'))
|
65
|
+
assert_equal(9, strcspn('abcxyz123', '&^(('))
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_strcspn_expected_errors
|
69
|
+
assert_raise(ArgumentError){ strcspn }
|
70
|
+
assert_raise(ArgumentError){ strcspn('alpha') }
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_strlen
|
74
|
+
assert_respond_to(self, :strlen)
|
75
|
+
assert_equal(5, strlen('hello'))
|
76
|
+
assert_equal(0, strlen(''))
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_strlen_expected_errors
|
80
|
+
assert_raise(ArgumentError){ strlen }
|
81
|
+
assert_raise(ArgumentError){ strlen('a', 'b') }
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_strncpy
|
85
|
+
assert_respond_to(self, :strncpy)
|
86
|
+
assert_equal('alp', strncpy(@buf, 'alpha', 3))
|
87
|
+
assert_equal('alp', @buf.strip)
|
88
|
+
end
|
89
|
+
|
90
|
+
def teardown
|
91
|
+
@buf = nil
|
92
|
+
end
|
93
|
+
end
|
data/test/tc_msvcrt_time.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_msvcrt_time.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::MSVCRT::Time module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/msvcrt/time'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class MTimeFoo
|
10
|
-
include Windows::MSVCRT::Time
|
11
|
-
end
|
12
|
-
|
13
|
-
class TC_Windows_MSVCRT_Time < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@foo = MTimeFoo.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_method_constants
|
19
|
-
assert_not_nil(MTimeFoo::Asctime)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_asctime
|
23
|
-
assert_respond_to(@foo, :asctime)
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
@foo = nil
|
28
|
-
end
|
29
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_msvcrt_time.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::MSVCRT::Time module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/msvcrt/time'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class MTimeFoo
|
10
|
+
include Windows::MSVCRT::Time
|
11
|
+
end
|
12
|
+
|
13
|
+
class TC_Windows_MSVCRT_Time < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@foo = MTimeFoo.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_method_constants
|
19
|
+
assert_not_nil(MTimeFoo::Asctime)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_asctime
|
23
|
+
assert_respond_to(@foo, :asctime)
|
24
|
+
end
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
@foo = nil
|
28
|
+
end
|
29
|
+
end
|