net-ping 1.3.3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,122 @@
1
+ ########################################################################
2
+ # test_net_ping_udp.rb
3
+ #
4
+ # Test case for the Net::Ping::UDP class. This should be run via the
5
+ # 'test' or 'test:udp' Rake tasks.
6
+ #
7
+ # If someone could provide me a host where a udp ping actually
8
+ # works (with a service check), I would appreciate it. :)
9
+ ########################################################################
10
+ require 'rubygems'
11
+ gem 'test-unit'
12
+
13
+ require 'test/unit'
14
+ require 'net/ping/udp'
15
+
16
+ class TC_Net_Ping_UDP < Test::Unit::TestCase
17
+ def setup
18
+ Net::Ping::UDP.service_check = false
19
+ @host = '127.0.0.1'
20
+ @udp = Net::Ping::UDP.new(@host)
21
+ end
22
+
23
+ test "ping basic functionality" do
24
+ assert_respond_to(@udp, :ping)
25
+ assert_nothing_raised{ @udp.ping }
26
+ end
27
+
28
+ test "ping accepts a host as an argument" do
29
+ assert_nothing_raised{ @udp.ping(@host) }
30
+ end
31
+
32
+ test "ping? is an alias for ping" do
33
+ assert_respond_to(@udp, :ping?)
34
+ assert_alias_method(@udp, :ping?, :ping)
35
+ end
36
+
37
+ test "pingecho is an alias for ping" do
38
+ assert_respond_to(@udp, :pingecho)
39
+ assert_alias_method(@udp, :pingecho, :ping)
40
+ end
41
+
42
+ test "a successful udp ping returns true" do
43
+ assert_true(@udp.ping?)
44
+ end
45
+
46
+ test "bind basic functionality" do
47
+ assert_respond_to(@udp, :bind)
48
+ assert_nothing_raised{ @udp.bind('127.0.0.1', 80) }
49
+ end
50
+
51
+ test "duration basic functionality" do
52
+ assert_nothing_raised{ @udp.ping }
53
+ assert_respond_to(@udp, :duration)
54
+ assert_kind_of(Float, @udp.duration)
55
+ end
56
+
57
+ test "host basic functionality" do
58
+ assert_respond_to(@udp, :host)
59
+ assert_respond_to(@udp, :host=)
60
+ assert_equal('127.0.0.1', @udp.host)
61
+ end
62
+
63
+ test "port basic functionality" do
64
+ assert_respond_to(@udp, :port)
65
+ assert_respond_to(@udp, :port=)
66
+ assert_equal(7, @udp.port)
67
+ end
68
+
69
+ test "timeout basic functionality" do
70
+ assert_respond_to(@udp, :timeout)
71
+ assert_respond_to(@udp, :timeout=)
72
+ end
73
+
74
+ test "timeout default value is five" do
75
+ assert_equal(5, @udp.timeout)
76
+ end
77
+
78
+ test "exception basic functionality" do
79
+ assert_respond_to(@udp, :exception)
80
+ end
81
+
82
+ test "the exception attribute returns nil if the ping is successful" do
83
+ assert_true(@udp.ping?)
84
+ assert_nil(@udp.exception)
85
+ end
86
+
87
+ test "the exception attribute is not nil if the ping is unsuccessful" do
88
+ assert_false(@udp.ping?('www.ruby-lang.org'))
89
+ assert_not_nil(@udp.exception)
90
+ end
91
+
92
+ test "warning basic functionality" do
93
+ assert_respond_to(@udp, :warning)
94
+ end
95
+
96
+ test "the warning attribute returns nil if the ping is successful" do
97
+ assert_true(@udp.ping?)
98
+ assert_nil(@udp.warning)
99
+ end
100
+
101
+ test "service_check basic functionality" do
102
+ assert_respond_to(Net::Ping::UDP, :service_check)
103
+ assert_respond_to(Net::Ping::UDP, :service_check=)
104
+ end
105
+
106
+ test "service_check attribute has been set to false" do
107
+ assert_false(Net::Ping::UDP.service_check)
108
+ end
109
+
110
+ test "service_check getter method does not accept arguments" do
111
+ assert_raise(ArgumentError){ Net::Ping::UDP.service_check(1) }
112
+ end
113
+
114
+ test "service_check setter method only accepts boolean arguments" do
115
+ assert_raise(ArgumentError){ Net::Ping::UDP.service_check = 1 }
116
+ end
117
+
118
+ def teardown
119
+ @host = nil
120
+ @udp = nil
121
+ end
122
+ end
@@ -0,0 +1,84 @@
1
+ #######################################################################
2
+ # test_net_ping_wmi.rb
3
+ #
4
+ # Test case for the Net::Ping::WMI class. These tests will only be
5
+ # run MS Windows. You should run this test via the 'test' or
6
+ # 'test:wmi' Rake task.
7
+ #######################################################################
8
+ require 'rubygems'
9
+ gem 'test-unit'
10
+
11
+ require 'test/unit'
12
+ require 'net/ping/wmi'
13
+ include Net
14
+
15
+ class TC_Ping_WMI < Test::Unit::TestCase
16
+ def self.startup
17
+ @@windows = Config::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
18
+ end
19
+
20
+ def setup
21
+ @host = "www.ruby-lang.org"
22
+ @wmi = Ping::WMI.new(@host) if @@windows
23
+ end
24
+
25
+ def test_ping_basic
26
+ omit_unless(@@windows, 'skipped on Unix platforms')
27
+ assert_respond_to(@wmi, :ping)
28
+ assert_nothing_raised{ @wmi.ping }
29
+ end
30
+
31
+ def test_ping_with_host
32
+ omit_unless(@@windows, 'skipped on Unix platforms')
33
+ assert_nothing_raised{ @wmi.ping(@host) }
34
+ end
35
+
36
+ def test_ping_with_options
37
+ omit_unless(@@windows, 'skipped on Unix platforms')
38
+ assert_nothing_raised{ @wmi.ping(@host, :NoFragmentation => true) }
39
+ end
40
+
41
+ def test_pingecho_alias
42
+ omit_unless(@@windows, 'skipped on Unix platforms')
43
+ assert_respond_to(@wmi, :pingecho)
44
+ assert_nothing_raised{ @wmi.pingecho }
45
+ assert_nothing_raised{ @wmi.pingecho(@host) }
46
+ end
47
+
48
+ def test_ping_returns_struct
49
+ omit_unless(@@windows, 'skipped on Unix platforms')
50
+ assert_kind_of(Struct::PingStatus, @wmi.ping)
51
+ end
52
+
53
+ def test_ping_returns_boolean
54
+ omit_unless(@@windows, 'skipped on Unix platforms')
55
+ assert_boolean(@wmi.ping?)
56
+ assert_boolean(@wmi.ping?(@host))
57
+ end
58
+
59
+ def test_ping_expected_failure
60
+ omit_unless(@@windows, 'skipped on Unix platforms')
61
+ assert_false(Ping::WMI.new('bogus').ping?)
62
+ assert_false(Ping::WMI.new('http://www.asdfhjklasdfhlkj.com').ping?)
63
+ end
64
+
65
+ def test_exception
66
+ omit_unless(@@windows, 'skipped on Unix platforms')
67
+ assert_respond_to(@wmi, :exception)
68
+ assert_nothing_raised{ @wmi.ping }
69
+ assert_nil(@wmi.exception)
70
+ end
71
+
72
+ def test_warning
73
+ assert_respond_to(@wmi, :warning)
74
+ end
75
+
76
+ def teardown
77
+ @host = nil
78
+ @wmi = nil
79
+ end
80
+
81
+ def self.shutdown
82
+ @@windows = nil
83
+ end
84
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: net-ping
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 3
8
+ - 3
9
+ version: 1.3.3
10
+ platform: x86-mingw32
11
+ authors:
12
+ - Daniel J. Berger
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-21 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: test-unit
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 0
30
+ - 9
31
+ version: 2.0.9
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: windows-pr
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 8
45
+ version: 1.0.8
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: win32-open3
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ - 3
58
+ - 1
59
+ version: 0.3.1
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ description: " The net-ping library provides a ping interface for Ruby. It includes\n separate TCP, HTTP, ICMP, UDP, WMI (for Windows) and external ping\n classes.\n"
63
+ email: djberg96@gmail.com
64
+ executables: []
65
+
66
+ extensions: []
67
+
68
+ extra_rdoc_files:
69
+ - README
70
+ - CHANGES
71
+ - doc/ping.txt
72
+ files:
73
+ - CHANGES
74
+ - doc/ping.txt
75
+ - examples/example_pingexternal.rb
76
+ - examples/example_pinghttp.rb
77
+ - examples/example_pingtcp.rb
78
+ - examples/example_pingudp.rb
79
+ - lib/net/ping/external.rb
80
+ - lib/net/ping/http.rb
81
+ - lib/net/ping/icmp.rb
82
+ - lib/net/ping/ping.rb
83
+ - lib/net/ping/tcp.rb
84
+ - lib/net/ping/udp.rb
85
+ - lib/net/ping/wmi.rb
86
+ - lib/net/ping.rb
87
+ - MANIFEST
88
+ - net-ping.gemspec
89
+ - Rakefile
90
+ - README
91
+ - test/test_net_ping.rb
92
+ - test/test_net_ping_external.rb
93
+ - test/test_net_ping_http.rb
94
+ - test/test_net_ping_icmp.rb
95
+ - test/test_net_ping_tcp.rb
96
+ - test/test_net_ping_udp.rb
97
+ - test/test_net_ping_wmi.rb
98
+ has_rdoc: true
99
+ homepage: http://www.rubyforge.org/projects/shards
100
+ licenses:
101
+ - Artistic 2.0
102
+ post_install_message:
103
+ rdoc_options: []
104
+
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
113
+ version: "0"
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirements: []
122
+
123
+ rubyforge_project: shards
124
+ rubygems_version: 1.3.6
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: A ping interface for Ruby.
128
+ test_files:
129
+ - test/test_net_ping.rb