lwes 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ Version 0.6.1 (erik-s-chang)
2
+ * fix broken 0.6.0 release, no code changes
3
+
1
4
  Version 0.6.0 (erik-s-chang)
2
5
  * start of a new LWES::Event type, mostly incomplete, but able
3
6
  to parse UDP buffers into a hash.
@@ -0,0 +1,7 @@
1
+ # this class is incomplete, but will eventually be subclassable
2
+ # like Struct in Ruby
3
+ class LWES::Event
4
+ def inspect
5
+ "#<#{self.class}:#{to_hash}>"
6
+ end
7
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{lwes}
3
- s.version = "0.6.0"
3
+ s.version = "0.6.1"
4
4
  s.date = Time.now
5
5
  s.authors = ["Erik S. Chang", "Frank Maritato"]
6
6
  s.email = %q{lwes-devel@lists.sourceforge.net}
@@ -22,16 +22,16 @@ Rakefile
22
22
  examples/demo.rb
23
23
  examples/my_events.esf
24
24
  ext/lwes/emitter.c
25
+ ext/lwes/event.c
25
26
  ext/lwes/extconf.rb
26
27
  ext/lwes/lwes-0.22.3.diff
27
- ext/lwes/lwes-0.22.3.tar.gz
28
28
  ext/lwes/lwes.c
29
29
  ext/lwes/lwes_ruby.h
30
- ext/lwes/event.c
31
30
  ext/lwes/numeric.c
32
31
  ext/lwes/type_db.c
33
32
  lib/lwes.rb
34
33
  lib/lwes/emitter.rb
34
+ lib/lwes/event.rb
35
35
  lib/lwes/struct.rb
36
36
  lib/lwes/type_db.rb
37
37
  lwes.gemspec
@@ -42,8 +42,11 @@ test/unit/test1.esf
42
42
  test/unit/test2.esf
43
43
  test/unit/test_emit_struct.rb
44
44
  test/unit/test_emitter.rb
45
+ test/unit/test_event.rb
45
46
  test/unit/test_struct.rb
46
47
  test/unit/test_type_db.rb
48
+ ) + %w(
49
+ ext/lwes/lwes-0.22.3.tar.gz
47
50
  )
48
51
  s.rubyforge_project = 'lwes'
49
52
  s.test_files = s.files.grep(%r{\Atest/unit/test_})
@@ -0,0 +1,69 @@
1
+ require "#{File.expand_path(File.dirname(__FILE__))}/../test_helper"
2
+ require 'ipaddr'
3
+
4
+ class TestEvent < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @options = LISTENER_DEFAULTS.dup
8
+ end
9
+
10
+ def test_inspect
11
+ ev = LWES::Event.new
12
+ assert_instance_of String, ev.inspect
13
+ end
14
+
15
+ def test_to_hash
16
+ ev = LWES::Event.new
17
+ assert_equal({}, ev.to_hash)
18
+ end
19
+
20
+ def test_emit_recieve_hash
21
+ receiver = UDPSocket.new
22
+ receiver.bind(nil, @options[:port])
23
+ emitter = LWES::Emitter.new(@options)
24
+ tmp = {
25
+ :str => 'hello',
26
+ :uint16 => [ :uint16, 6344 ],
27
+ :int16 => [ :int16, -6344 ],
28
+ :uint32 => [ :uint32, 6344445 ],
29
+ :int32 => [ :int32, -6344445 ],
30
+ :uint64 => [ :uint64, 6344445123123 ],
31
+ :int64 => [ :int64, -6344445123123 ],
32
+ :true => true,
33
+ :false => false,
34
+ :addr => [ :ip_addr, "127.0.0.1" ],
35
+ }
36
+
37
+ emitter.emit "Event", tmp
38
+ buf, addr = receiver.recvfrom(65536)
39
+ parsed = LWES::Event.parse(buf)
40
+ expect = {
41
+ :name => "Event",
42
+ :uint16 => 6344,
43
+ :str => "hello",
44
+ :int16 => -6344,
45
+ :uint32 => 6344445,
46
+ :int32 => -6344445,
47
+ :uint64 => 6344445123123,
48
+ :int64 => -6344445123123,
49
+ :true => true,
50
+ :false => false,
51
+ :addr => "127.0.0.1",
52
+ }
53
+ assert_instance_of LWES::Event, parsed
54
+ assert_equal expect, parsed.to_hash
55
+
56
+ # test for round tripping
57
+ emitter.emit parsed
58
+ buf, addr = receiver.recvfrom(65536)
59
+ assert_instance_of LWES::Event, parsed
60
+ assert_equal expect, parsed.to_hash
61
+
62
+ emitter << parsed
63
+ buf, addr = receiver.recvfrom(65536)
64
+ assert_instance_of LWES::Event, parsed
65
+ assert_equal expect, parsed.to_hash
66
+ ensure
67
+ receiver.close
68
+ end
69
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Erik S. Chang
@@ -40,16 +40,16 @@ files:
40
40
  - examples/demo.rb
41
41
  - examples/my_events.esf
42
42
  - ext/lwes/emitter.c
43
+ - ext/lwes/event.c
43
44
  - ext/lwes/extconf.rb
44
45
  - ext/lwes/lwes-0.22.3.diff
45
- - ext/lwes/lwes-0.22.3.tar.gz
46
46
  - ext/lwes/lwes.c
47
47
  - ext/lwes/lwes_ruby.h
48
- - ext/lwes/event.c
49
48
  - ext/lwes/numeric.c
50
49
  - ext/lwes/type_db.c
51
50
  - lib/lwes.rb
52
51
  - lib/lwes/emitter.rb
52
+ - lib/lwes/event.rb
53
53
  - lib/lwes/struct.rb
54
54
  - lib/lwes/type_db.rb
55
55
  - lwes.gemspec
@@ -60,8 +60,10 @@ files:
60
60
  - test/unit/test2.esf
61
61
  - test/unit/test_emit_struct.rb
62
62
  - test/unit/test_emitter.rb
63
+ - test/unit/test_event.rb
63
64
  - test/unit/test_struct.rb
64
65
  - test/unit/test_type_db.rb
66
+ - ext/lwes/lwes-0.22.3.tar.gz
65
67
  has_rdoc: true
66
68
  homepage: http://www.lwes.org/
67
69
  licenses: []
@@ -97,5 +99,6 @@ summary: Ruby API for the Light Weight Event System
97
99
  test_files:
98
100
  - test/unit/test_emit_struct.rb
99
101
  - test/unit/test_emitter.rb
102
+ - test/unit/test_event.rb
100
103
  - test/unit/test_struct.rb
101
104
  - test/unit/test_type_db.rb