retro_idl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/ext/retro_idl/asn/ext_parser/ext_common.h +27 -0
  3. data/ext/retro_idl/asn/ext_parser/ext_parser.l +201 -0
  4. data/ext/retro_idl/asn/ext_parser/ext_parser.y +1207 -0
  5. data/ext/retro_idl/asn/ext_parser/extconf.rb +3 -0
  6. data/ext/retro_idl/asn/ext_parser/lexer.c +2873 -0
  7. data/ext/retro_idl/asn/ext_parser/lexer.h +366 -0
  8. data/ext/retro_idl/asn/ext_parser/parser.c +2963 -0
  9. data/ext/retro_idl/asn/ext_parser/parser.h +175 -0
  10. data/lib/retro_idl/asn/alternative_type.rb +43 -0
  11. data/lib/retro_idl/asn/asn.rb +309 -0
  12. data/lib/retro_idl/asn/asn_error.rb +2 -0
  13. data/lib/retro_idl/asn/base_type.rb +87 -0
  14. data/lib/retro_idl/asn/base_value.rb +75 -0
  15. data/lib/retro_idl/asn/bit_string.rb +44 -0
  16. data/lib/retro_idl/asn/boolean.rb +50 -0
  17. data/lib/retro_idl/asn/builtin_value.rb +51 -0
  18. data/lib/retro_idl/asn/choice.rb +95 -0
  19. data/lib/retro_idl/asn/component_type.rb +56 -0
  20. data/lib/retro_idl/asn/constraint.rb +162 -0
  21. data/lib/retro_idl/asn/defined_type.rb +61 -0
  22. data/lib/retro_idl/asn/defined_value.rb +82 -0
  23. data/lib/retro_idl/asn/enumerated.rb +127 -0
  24. data/lib/retro_idl/asn/enumeration_item.rb +103 -0
  25. data/lib/retro_idl/asn/integer.rb +84 -0
  26. data/lib/retro_idl/asn/location.rb +10 -0
  27. data/lib/retro_idl/asn/named_number.rb +83 -0
  28. data/lib/retro_idl/asn/null.rb +41 -0
  29. data/lib/retro_idl/asn/octetstring.rb +48 -0
  30. data/lib/retro_idl/asn/real.rb +36 -0
  31. data/lib/retro_idl/asn/sequence.rb +132 -0
  32. data/lib/retro_idl/asn/sequenceof.rb +62 -0
  33. data/lib/retro_idl/asn/single_value.rb +26 -0
  34. data/lib/retro_idl/asn/tag.rb +163 -0
  35. data/lib/retro_idl/asn/type_list.rb +121 -0
  36. data/lib/retro_idl/asn/value_assignment.rb +21 -0
  37. data/lib/retro_idl/asn/value_list.rb +48 -0
  38. data/lib/retro_idl.rb +20 -0
  39. data/rakefile +33 -0
  40. data/test/asn/ext_parser/capture_stderr.rb +20 -0
  41. data/test/asn/ext_parser/tc_ext_parser.rb +94 -0
  42. data/test/asn/parser/capture_stderr.rb +20 -0
  43. data/test/asn/parser/tc_parser.rb +90 -0
  44. metadata +133 -0
@@ -0,0 +1,90 @@
1
+ require_relative "capture_stderr"
2
+ require "test/unit"
3
+ require "retro_idl"
4
+
5
+ inputs = {}
6
+ root = "test/asn/input"
7
+
8
+ # generate TestParser at runtime with one test per input file
9
+ testClass = Class.new(Test::Unit::TestCase) do
10
+
11
+ class << self
12
+
13
+ attr_accessor :inputs
14
+
15
+ end
16
+
17
+ Dir.foreach(root) do |filename|
18
+
19
+ next if filename == ".." or filename == "."
20
+
21
+ test_name = "test_#{filename.sub(".asn1", "")}"
22
+ inputs[test_name.to_sym] = {:fileName => filename, :buffer => File.new("#{root}/#{filename}", "r").read}
23
+
24
+ # positive tests
25
+ if filename[/^pos_.*\.asn1$/]
26
+
27
+ define_method( test_name ) do
28
+
29
+ output = nil
30
+
31
+ # run stage 1 and intercept stderr output
32
+ err = capture_stderr do
33
+
34
+ output = RetroIDL::ASN::ASN.new(inputs[__method__])
35
+
36
+ end
37
+
38
+ # there should have been no messages to stderr
39
+ assert_equal("", err.string, "unexpected error messages")
40
+
41
+ # if there were messages, forward them to stderr
42
+ if err.string != ""
43
+
44
+ STDERR.puts err.string
45
+
46
+ end
47
+
48
+ puts output.to_s
49
+
50
+ end
51
+
52
+ end
53
+
54
+ # negative tests
55
+ if filename[/^neg_.*\.asn1$/]
56
+
57
+ define_method( test_name ) do
58
+
59
+ # run stage 1 and intercept stderr output
60
+ err = capture_stderr do
61
+
62
+ output = RetroIDL::ASN::ASN.new(inputs[__method__])
63
+
64
+ end
65
+
66
+ # there should have been some messages to stderr
67
+ assert_not_equal("", err.string, "expecting error messages but got none")
68
+
69
+ # if there were messages, forward them to stderr
70
+ if err.string != ""
71
+
72
+ STDERR.puts err.string
73
+
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+
80
+
81
+ end
82
+
83
+ end
84
+
85
+ # set inputs as a class variable
86
+ testClass.inputs = inputs
87
+
88
+ # name the dynamic test class
89
+ Object.const_set("TestParser", testClass)
90
+
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: retro_idl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Harper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake-compiler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email: contact@cjh.id.au
57
+ executables: []
58
+ extensions:
59
+ - ext/retro_idl/asn/ext_parser/extconf.rb
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ext/retro_idl/asn/ext_parser/ext_common.h
63
+ - ext/retro_idl/asn/ext_parser/ext_parser.l
64
+ - ext/retro_idl/asn/ext_parser/ext_parser.y
65
+ - ext/retro_idl/asn/ext_parser/extconf.rb
66
+ - ext/retro_idl/asn/ext_parser/lexer.c
67
+ - ext/retro_idl/asn/ext_parser/lexer.h
68
+ - ext/retro_idl/asn/ext_parser/parser.c
69
+ - ext/retro_idl/asn/ext_parser/parser.h
70
+ - lib/retro_idl.rb
71
+ - lib/retro_idl/asn/alternative_type.rb
72
+ - lib/retro_idl/asn/asn.rb
73
+ - lib/retro_idl/asn/asn_error.rb
74
+ - lib/retro_idl/asn/base_type.rb
75
+ - lib/retro_idl/asn/base_value.rb
76
+ - lib/retro_idl/asn/bit_string.rb
77
+ - lib/retro_idl/asn/boolean.rb
78
+ - lib/retro_idl/asn/builtin_value.rb
79
+ - lib/retro_idl/asn/choice.rb
80
+ - lib/retro_idl/asn/component_type.rb
81
+ - lib/retro_idl/asn/constraint.rb
82
+ - lib/retro_idl/asn/defined_type.rb
83
+ - lib/retro_idl/asn/defined_value.rb
84
+ - lib/retro_idl/asn/enumerated.rb
85
+ - lib/retro_idl/asn/enumeration_item.rb
86
+ - lib/retro_idl/asn/integer.rb
87
+ - lib/retro_idl/asn/location.rb
88
+ - lib/retro_idl/asn/named_number.rb
89
+ - lib/retro_idl/asn/null.rb
90
+ - lib/retro_idl/asn/octetstring.rb
91
+ - lib/retro_idl/asn/real.rb
92
+ - lib/retro_idl/asn/sequence.rb
93
+ - lib/retro_idl/asn/sequenceof.rb
94
+ - lib/retro_idl/asn/single_value.rb
95
+ - lib/retro_idl/asn/tag.rb
96
+ - lib/retro_idl/asn/type_list.rb
97
+ - lib/retro_idl/asn/value_assignment.rb
98
+ - lib/retro_idl/asn/value_list.rb
99
+ - rakefile
100
+ - test/asn/ext_parser/capture_stderr.rb
101
+ - test/asn/ext_parser/tc_ext_parser.rb
102
+ - test/asn/parser/capture_stderr.rb
103
+ - test/asn/parser/tc_parser.rb
104
+ homepage: https://github.com/cjhdev/retro_idl
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '2.0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.5.1
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: ASN.1 and standard encoding rules as an IDL
128
+ test_files:
129
+ - test/asn/ext_parser/capture_stderr.rb
130
+ - test/asn/ext_parser/tc_ext_parser.rb
131
+ - test/asn/parser/tc_parser.rb
132
+ - test/asn/parser/capture_stderr.rb
133
+ has_rdoc: yard