sdl4r 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +14 -1
- data/README +4 -4
- data/Rakefile +15 -12
- data/TODO +11 -4
- data/lib/sdl4r/parser.rb +25 -33
- data/lib/sdl4r/parser/token.rb +1 -1
- data/lib/sdl4r/sdl4r.rb +50 -22
- data/lib/sdl4r/sdl_time_span.rb +2 -2
- data/lib/sdl4r/serializer.rb +152 -0
- data/lib/sdl4r/tag.rb +15 -1
- data/test/sdl4r/parser_test.rb +5 -0
- data/test/sdl4r/serializer_test.rb +78 -0
- data/test/sdl4r/tag_test.rb +20 -1
- metadata +52 -81
- data/doc/classes/SDL4R.html +0 -408
- data/doc/classes/SDL4R/Parser.html +0 -190
- data/doc/classes/SDL4R/ParserTest.html +0 -385
- data/doc/classes/SDL4R/SDL4RTest.html +0 -532
- data/doc/classes/SDL4R/SDLTest.html +0 -77
- data/doc/classes/SDL4R/SdlBinary.html +0 -188
- data/doc/classes/SDL4R/SdlParseError.html +0 -110
- data/doc/classes/SDL4R/SdlTimeSpan.html +0 -637
- data/doc/classes/SDL4R/Tag.html +0 -1249
- data/doc/classes/SDL4R/TagTest.html +0 -292
- data/doc/created.rid +0 -1
- data/doc/files/CHANGELOG.html +0 -200
- data/doc/files/LICENSE.html +0 -497
- data/doc/files/README.html +0 -406
- data/doc/files/lib/sdl4r/parser/reader_rb.html +0 -54
- data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +0 -54
- data/doc/files/lib/sdl4r/parser/token_rb.html +0 -54
- data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +0 -54
- data/doc/files/lib/sdl4r/parser_rb.html +0 -62
- data/doc/files/lib/sdl4r/sdl4r_rb.html +0 -64
- data/doc/files/lib/sdl4r/sdl_binary_rb.html +0 -54
- data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +0 -54
- data/doc/files/lib/sdl4r/sdl_time_span_rb.html +0 -54
- data/doc/files/lib/sdl4r/tag_rb.html +0 -64
- data/doc/files/lib/sdl4r_rb.html +0 -54
- data/doc/files/test/sdl4r/parser_test_rb.html +0 -64
- data/doc/files/test/sdl4r/sdl4r_test_rb.html +0 -67
- data/doc/files/test/sdl4r/sdl_test_rb.html +0 -64
- data/doc/files/test/sdl4r/tag_test_rb.html +0 -64
- data/doc/fr_class_index.html +0 -19
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -4711
- data/doc/index.html +0 -15
- data/doc/rdoc-style.css +0 -328
@@ -1,532 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<title>: SDL4R::SDL4RTest [RDoc: Simple Declarative Language for Ruby]</title>
|
5
|
-
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
|
-
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
-
<script type='text/javascript'>
|
8
|
-
//<![CDATA[
|
9
|
-
function popupCode(url) {
|
10
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
-
}
|
12
|
-
|
13
|
-
function toggleCode(id) {
|
14
|
-
var code = document.getElementById(id)
|
15
|
-
|
16
|
-
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
-
return true
|
18
|
-
}
|
19
|
-
|
20
|
-
// Make codeblocks hidden by default
|
21
|
-
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
-
//]]>
|
23
|
-
</script>
|
24
|
-
</head>
|
25
|
-
<body class='page'>
|
26
|
-
<div class='class' id='wrapper'>
|
27
|
-
<div class='header'>
|
28
|
-
<h1 class='name'>
|
29
|
-
<span class='type'>Class</span>
|
30
|
-
SDL4R::SDL4RTest
|
31
|
-
</h1>
|
32
|
-
<ol class='paths'>
|
33
|
-
<li>
|
34
|
-
<a href="../../files/test/sdl4r/sdl4r_test_rb.html">test/sdl4r/sdl4r_test.rb</a>
|
35
|
-
</li>
|
36
|
-
</ol>
|
37
|
-
<div class='parent'>
|
38
|
-
Parent:
|
39
|
-
<strong>Test::Unit::TestCase</strong>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
<div id='content'>
|
43
|
-
<div id='text'>
|
44
|
-
<div id='description'>
|
45
|
-
<p>
|
46
|
-
SDL unit tests.
|
47
|
-
</p>
|
48
|
-
<p>
|
49
|
-
@author Daniel Leuck
|
50
|
-
</p>
|
51
|
-
</div>
|
52
|
-
<div id='method-list'>
|
53
|
-
<h2>Methods</h2>
|
54
|
-
<h3>public instance</h3>
|
55
|
-
<ol>
|
56
|
-
<li><a href="#M000130">assert_tags_equal</a></li>
|
57
|
-
<li><a href="#M000136">check_tag_write_parse</a></li>
|
58
|
-
<li><a href="#M000131">get_test_sdl_file_path</a></li>
|
59
|
-
<li><a href="#M000132">setup</a></li>
|
60
|
-
<li><a href="#M000149">test_attributes</a></li>
|
61
|
-
<li><a href="#M000146">test_binaries</a></li>
|
62
|
-
<li><a href="#M000141">test_booleans</a></li>
|
63
|
-
<li><a href="#M000138">test_characters</a></li>
|
64
|
-
<li><a href="#M000139">test_characters_unicode</a></li>
|
65
|
-
<li><a href="#M000151">test_children</a></li>
|
66
|
-
<li><a href="#M000145">test_date_times</a></li>
|
67
|
-
<li><a href="#M000143">test_dates</a></li>
|
68
|
-
<li><a href="#M000147">test_empty_tag</a></li>
|
69
|
-
<li><a href="#M000152">test_namespaces</a></li>
|
70
|
-
<li><a href="#M000142">test_null</a></li>
|
71
|
-
<li><a href="#M000140">test_numbers</a></li>
|
72
|
-
<li><a href="#M000137">test_strings</a></li>
|
73
|
-
<li><a href="#M000133">test_tag</a></li>
|
74
|
-
<li><a href="#M000134">test_tag_write_parse_basic_types</a></li>
|
75
|
-
<li><a href="#M000135">test_tag_write_parse_structures</a></li>
|
76
|
-
<li><a href="#M000144">test_time_spans</a></li>
|
77
|
-
<li><a href="#M000148">test_values</a></li>
|
78
|
-
<li><a href="#M000150">test_values_and_attributes</a></li>
|
79
|
-
</ol>
|
80
|
-
</div>
|
81
|
-
<div id='section'>
|
82
|
-
<div id='constants-list'>
|
83
|
-
<h2>Constants</h2>
|
84
|
-
<div class='name-list'>
|
85
|
-
<table summary='Constants'>
|
86
|
-
<tr class='top-aligned-row context-row'>
|
87
|
-
<td class='context-item-name'>TAG</td>
|
88
|
-
<td>=</td>
|
89
|
-
<td class='context-item-value'>"Tag"</td>
|
90
|
-
<td> </td>
|
91
|
-
<td class='context-item-desc'>
|
92
|
-
|
93
|
-
<a href="Tag.html">Tag</a> datastructure tests
|
94
|
-
</td>
|
95
|
-
</tr>
|
96
|
-
<tr class='top-aligned-row context-row'>
|
97
|
-
<td class='context-item-name'>TAG_WRITE_PARSE</td>
|
98
|
-
<td>=</td>
|
99
|
-
<td class='context-item-value'>"Tag Write Parse"</td>
|
100
|
-
</tr>
|
101
|
-
<tr class='top-aligned-row context-row'>
|
102
|
-
<td class='context-item-name'>STRING_DECLARATIONS</td>
|
103
|
-
<td>=</td>
|
104
|
-
<td class='context-item-value'>"String Declarations"</td>
|
105
|
-
<td> </td>
|
106
|
-
<td class='context-item-desc'>
|
107
|
-
|
108
|
-
Basic Types Tests
|
109
|
-
</td>
|
110
|
-
</tr>
|
111
|
-
<tr class='top-aligned-row context-row'>
|
112
|
-
<td class='context-item-name'>CHARACTER_DECLARATIONS</td>
|
113
|
-
<td>=</td>
|
114
|
-
<td class='context-item-value'>"Character Declarations"</td>
|
115
|
-
</tr>
|
116
|
-
<tr class='top-aligned-row context-row'>
|
117
|
-
<td class='context-item-name'>NUMBER_DECLARATIONS</td>
|
118
|
-
<td>=</td>
|
119
|
-
<td class='context-item-value'>"Number Declarations"</td>
|
120
|
-
</tr>
|
121
|
-
<tr class='top-aligned-row context-row'>
|
122
|
-
<td class='context-item-name'>BOOLEAN_DECLARATIONS</td>
|
123
|
-
<td>=</td>
|
124
|
-
<td class='context-item-value'>"Boolean Declarations"</td>
|
125
|
-
</tr>
|
126
|
-
<tr class='top-aligned-row context-row'>
|
127
|
-
<td class='context-item-name'>NULL_DECLARATION</td>
|
128
|
-
<td>=</td>
|
129
|
-
<td class='context-item-value'>"Null Declaration"</td>
|
130
|
-
</tr>
|
131
|
-
<tr class='top-aligned-row context-row'>
|
132
|
-
<td class='context-item-name'>DATE_DECLARATIONS</td>
|
133
|
-
<td>=</td>
|
134
|
-
<td class='context-item-value'>"Date Declarations"</td>
|
135
|
-
</tr>
|
136
|
-
<tr class='top-aligned-row context-row'>
|
137
|
-
<td class='context-item-name'>TIME_SPAN_DECLARATIONS</td>
|
138
|
-
<td>=</td>
|
139
|
-
<td class='context-item-value'>"Time Span Declarations"</td>
|
140
|
-
</tr>
|
141
|
-
<tr class='top-aligned-row context-row'>
|
142
|
-
<td class='context-item-name'>DATE_TIME_DECLARATIONS</td>
|
143
|
-
<td>=</td>
|
144
|
-
<td class='context-item-value'>"Date Time Declarations"</td>
|
145
|
-
</tr>
|
146
|
-
<tr class='top-aligned-row context-row'>
|
147
|
-
<td class='context-item-name'>BINARY_DECLARATIONS</td>
|
148
|
-
<td>=</td>
|
149
|
-
<td class='context-item-value'>"Binary Declarations";</td>
|
150
|
-
</tr>
|
151
|
-
<tr class='top-aligned-row context-row'>
|
152
|
-
<td class='context-item-name'>EMPTY_TAG</td>
|
153
|
-
<td>=</td>
|
154
|
-
<td class='context-item-value'>"Empty Tag"</td>
|
155
|
-
<td> </td>
|
156
|
-
<td class='context-item-desc'>
|
157
|
-
|
158
|
-
Structure Tests
|
159
|
-
</td>
|
160
|
-
</tr>
|
161
|
-
<tr class='top-aligned-row context-row'>
|
162
|
-
<td class='context-item-name'>VALUES</td>
|
163
|
-
<td>=</td>
|
164
|
-
<td class='context-item-value'>"Values"</td>
|
165
|
-
</tr>
|
166
|
-
<tr class='top-aligned-row context-row'>
|
167
|
-
<td class='context-item-name'>ATTRIBUTES</td>
|
168
|
-
<td>=</td>
|
169
|
-
<td class='context-item-value'>"Attributes"</td>
|
170
|
-
</tr>
|
171
|
-
<tr class='top-aligned-row context-row'>
|
172
|
-
<td class='context-item-name'>VALUES_AND_ATTRIBUTES</td>
|
173
|
-
<td>=</td>
|
174
|
-
<td class='context-item-value'>"Values and Attributes"</td>
|
175
|
-
</tr>
|
176
|
-
<tr class='top-aligned-row context-row'>
|
177
|
-
<td class='context-item-name'>CHILDREN</td>
|
178
|
-
<td>=</td>
|
179
|
-
<td class='context-item-value'>"Children"</td>
|
180
|
-
</tr>
|
181
|
-
<tr class='top-aligned-row context-row'>
|
182
|
-
<td class='context-item-name'>NAMESPACES</td>
|
183
|
-
<td>=</td>
|
184
|
-
<td class='context-item-value'>"Namespaces"</td>
|
185
|
-
</tr>
|
186
|
-
</table>
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
<div id='methods'>
|
190
|
-
<h2>Public instance methods</h2>
|
191
|
-
<div class='method public-instance' id='method-M000130'>
|
192
|
-
<a name='M000130'></a>
|
193
|
-
<div class='synopsis'>
|
194
|
-
<span class='name'>assert_tags_equal</span>
|
195
|
-
<span class='arguments'>(expected, actual, message)</span>
|
196
|
-
</div>
|
197
|
-
<div class='source'>
|
198
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000130-source'); return false">
|
199
|
-
[show source]
|
200
|
-
</a>
|
201
|
-
<pre id='M000130-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 67</span>
67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_tags_equal</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>)
68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">expected</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">actual</span>
69: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">expected</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">message</span>)
70: <span class="ruby-keyword kw">end</span>
71: <span class="ruby-keyword kw">end</span></pre>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
<div class='method public-instance' id='method-M000136'>
|
205
|
-
<a name='M000136'></a>
|
206
|
-
<div class='synopsis'>
|
207
|
-
<span class='name'>check_tag_write_parse</span>
|
208
|
-
<span class='arguments'>(root)</span>
|
209
|
-
</div>
|
210
|
-
<div class='description'>
|
211
|
-
<p>
|
212
|
-
Does a to_s/parse test on the specified <a href="Tag.html">Tag</a>
|
213
|
-
(<tt>root</tt>)
|
214
|
-
</p>
|
215
|
-
</div>
|
216
|
-
<div class='source'>
|
217
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000136-source'); return false">
|
218
|
-
[show source]
|
219
|
-
</a>
|
220
|
-
<pre id='M000136-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 139</span>
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_tag_write_parse</span>(<span class="ruby-identifier">root</span>)
140: <span class="ruby-comment cmt"># puts '========================================'</span>
141: <span class="ruby-comment cmt"># puts root.to_s</span>
142: <span class="ruby-comment cmt"># puts '========================================'</span>
143: 
144: <span class="ruby-identifier">write_parse_root</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"test"</span>).<span class="ruby-identifier">read</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">child</span>(<span class="ruby-value str">"root"</span>);
145: 
146: <span class="ruby-comment cmt"># File.open("d:\\dev\\tmp\\root.sdl", "w") { |io| io.write(root.to_string) }</span>
147: <span class="ruby-comment cmt"># File.open("d:\\dev\\tmp\\root_reparsed.sdl", "w") { |io| io.write(write_parse_root.to_string) }</span>
148: 
149: <span class="ruby-identifier">assert_tags_equal</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">write_parse_root</span>, <span class="ruby-value str">"write/parse"</span>)
150: <span class="ruby-keyword kw">end</span></pre>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
<div class='method public-instance' id='method-M000131'>
|
224
|
-
<a name='M000131'></a>
|
225
|
-
<div class='synopsis'>
|
226
|
-
<span class='name'>get_test_sdl_file_path</span>
|
227
|
-
<span class='arguments'>(filename)</span>
|
228
|
-
</div>
|
229
|
-
<div class='description'>
|
230
|
-
<p>
|
231
|
-
Returns a Pathname giving the location of the specified relative
|
232
|
-
<tt>filename</tt>.
|
233
|
-
</p>
|
234
|
-
<table>
|
235
|
-
<tr><td valign="top"><tt>filename</tt>:</td><td>path to a file relatively to this source file
|
236
|
-
|
237
|
-
</td></tr>
|
238
|
-
</table>
|
239
|
-
</div>
|
240
|
-
<div class='source'>
|
241
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000131-source'); return false">
|
242
|
-
[show source]
|
243
|
-
</a>
|
244
|
-
<pre id='M000131-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 77</span>
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_test_sdl_file_path</span>(<span class="ruby-identifier">filename</span>)
78: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>)
79: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">filename</span>)
80: <span class="ruby-keyword kw">end</span></pre>
|
245
|
-
</div>
|
246
|
-
</div>
|
247
|
-
<div class='method public-instance' id='method-M000132'>
|
248
|
-
<a name='M000132'></a>
|
249
|
-
<div class='synopsis'>
|
250
|
-
<span class='name'>setup</span>
|
251
|
-
<span class='arguments'>()</span>
|
252
|
-
</div>
|
253
|
-
<div class='source'>
|
254
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000132-source'); return false">
|
255
|
-
[show source]
|
256
|
-
</a>
|
257
|
-
<pre id='M000132-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 85</span>
85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
86: <span class="ruby-keyword kw">super</span>
87: 
88: <span class="ruby-ivar">@@root_basic_types</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-identifier">read</span>(<span class="ruby-identifier">get_test_sdl_file_path</span>(<span class="ruby-value str">"test_basic_types.sdl"</span>))
89: <span class="ruby-ivar">@@root_structures</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-identifier">read</span>(<span class="ruby-identifier">get_test_sdl_file_path</span>(<span class="ruby-value str">"test_structures.sdl"</span>))
90: <span class="ruby-keyword kw">end</span></pre>
|
258
|
-
</div>
|
259
|
-
</div>
|
260
|
-
<div class='method public-instance' id='method-M000149'>
|
261
|
-
<a name='M000149'></a>
|
262
|
-
<div class='synopsis'>
|
263
|
-
<span class='name'>test_attributes</span>
|
264
|
-
<span class='arguments'>()</span>
|
265
|
-
</div>
|
266
|
-
<div class='source'>
|
267
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000149-source'); return false">
|
268
|
-
[show source]
|
269
|
-
</a>
|
270
|
-
<pre id='M000149-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 400</span>
400: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_attributes</span>
401: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
402: 
403: <span class="ruby-identifier">assert_equal</span>(
404: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts1"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"joe"</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
405: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts2"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"size"</span> =<span class="ruby-operator">></span> <span class="ruby-value">5</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
406: <span class="ruby-identifier">assert_equal</span>(
407: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts3"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"joe"</span>,<span class="ruby-value str">"size"</span> =<span class="ruby-operator">></span> <span class="ruby-value">5</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
408: <span class="ruby-identifier">assert_equal</span>(
409: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts4"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"joe"</span>,<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>,<span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>},
410: <span class="ruby-constant">ATTRIBUTES</span>);
411: <span class="ruby-identifier">assert_equal</span>(
412: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts5"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"joe"</span>,<span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
413: <span class="ruby-identifier">assert_equal</span>(
414: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts6"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"joe"</span>,<span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
415: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts7"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"joe"</span>}, <span class="ruby-constant">ATTRIBUTES</span>);
416: <span class="ruby-identifier">assert_equal</span>(
417: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts8"</span>).<span class="ruby-identifier">attributes</span>,
418: {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"joe"</span>,<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>,<span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>,
419: <span class="ruby-value str">"text"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"hi"</span>,<span class="ruby-value str">"birthday"</span>=<span class="ruby-operator">></span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1972</span>,<span class="ruby-value">5</span>,<span class="ruby-value">23</span>)},
420: <span class="ruby-constant">ATTRIBUTES</span>);
421: <span class="ruby-identifier">assert_equal</span>(
422: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"atts9"</span>).<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">"key"</span>), <span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-constant">SdlBinary</span>(<span class="ruby-value str">"mykey"</span>), <span class="ruby-constant">ATTRIBUTES</span>)
423: <span class="ruby-keyword kw">end</span></pre>
|
271
|
-
</div>
|
272
|
-
</div>
|
273
|
-
<div class='method public-instance' id='method-M000146'>
|
274
|
-
<a name='M000146'></a>
|
275
|
-
<div class='synopsis'>
|
276
|
-
<span class='name'>test_binaries</span>
|
277
|
-
<span class='arguments'>()</span>
|
278
|
-
</div>
|
279
|
-
<div class='source'>
|
280
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000146-source'); return false">
|
281
|
-
[show source]
|
282
|
-
</a>
|
283
|
-
<pre id='M000146-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 324</span>
324: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_binaries</span>
325: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
326: 
327: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-constant">SdlBinary</span>(<span class="ruby-value str">"hi"</span>), <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"hi"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">BINARY_DECLARATIONS</span>)
328: <span class="ruby-identifier">assert_equal</span>(
329: <span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-constant">SdlBinary</span>(<span class="ruby-value str">"hi"</span>), <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"hi"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">BINARY_DECLARATIONS</span>)
330: <span class="ruby-identifier">assert_equal</span>(
331: <span class="ruby-constant">SdlBinary</span>.<span class="ruby-identifier">decode64</span>(
332: <span class="ruby-value str">"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAKnRFWHRDcmVhdGlvbiBUaW1l"</span> <span class="ruby-operator">+</span>
333: <span class="ruby-value str">"AERpIDQgTXJ6IDIwMDMgMDA6MjQ6MDQgKzAxMDDdSQ6OAAAAB3RJTUUH0wMEAAcllPlrJgAA"</span> <span class="ruby-operator">+</span>
334: <span class="ruby-value str">"AAlwSFlzAAAK8AAACvABQqw0mAAAAARnQU1BAACxjwv8YQUAAADQSURBVHjaY2CgEDCCyZn/"</span> <span class="ruby-operator">+</span>
335: <span class="ruby-value str">"3YHkDhL1ejCkM+5kgXJ2zDQmXueShwwMh9+ALWSEGcCQfhZIvHlDnAk8PAwMHBxgJtyAa7bX"</span> <span class="ruby-operator">+</span>
336: <span class="ruby-value str">"UdT8/cvA8Ps3hP7zB4FBYn/+vGbweqyJaoCmpiaKASDFv35BNMBoZMzwGKKOidJYoNgAuBdm"</span> <span class="ruby-operator">+</span>
337: <span class="ruby-value str">"naXQgHRKDfgagxD89w8S+iAaFICwGIHFAgjrHUczAByySAaAMEgDLBphhv7/D8EYLgDZhAxA"</span> <span class="ruby-operator">+</span>
338: <span class="ruby-value str">"mkAKYYbAMMwwDAOQXYDuDXRXgDC6AR7SW8jITNQAACjZgdj4VjlqAAAAAElFTkSuQmCC"</span>
339: ),
340: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"png"</span>).<span class="ruby-identifier">value</span>,
341: <span class="ruby-constant">BINARY_DECLARATIONS</span>)
342: <span class="ruby-keyword kw">end</span></pre>
|
284
|
-
</div>
|
285
|
-
</div>
|
286
|
-
<div class='method public-instance' id='method-M000141'>
|
287
|
-
<a name='M000141'></a>
|
288
|
-
<div class='synopsis'>
|
289
|
-
<span class='name'>test_booleans</span>
|
290
|
-
<span class='arguments'>()</span>
|
291
|
-
</div>
|
292
|
-
<div class='source'>
|
293
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000141-source'); return false">
|
294
|
-
[show source]
|
295
|
-
</a>
|
296
|
-
<pre id='M000141-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 239</span>
239: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_booleans</span>
240: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
241: 
242: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"light-on"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-constant">BOOLEAN_DECLARATIONS</span>)
243: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"light-off"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">BOOLEAN_DECLARATIONS</span>)
244: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"light1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-constant">BOOLEAN_DECLARATIONS</span>)
245: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"light2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">BOOLEAN_DECLARATIONS</span>)
246: <span class="ruby-keyword kw">end</span></pre>
|
297
|
-
</div>
|
298
|
-
</div>
|
299
|
-
<div class='method public-instance' id='method-M000138'>
|
300
|
-
<a name='M000138'></a>
|
301
|
-
<div class='synopsis'>
|
302
|
-
<span class='name'>test_characters</span>
|
303
|
-
<span class='arguments'>()</span>
|
304
|
-
</div>
|
305
|
-
<div class='source'>
|
306
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000138-source'); return false">
|
307
|
-
[show source]
|
308
|
-
</a>
|
309
|
-
<pre id='M000138-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 185</span>
185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_characters</span>
186: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
187: 
188: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
189: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">'A'</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
190: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">'\\'</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
191: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char4"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"\n"</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
192: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char5"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"\t"</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
193: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char6"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">'\''</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
194: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char7"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">'"'</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>)
195: <span class="ruby-keyword kw">end</span></pre>
|
310
|
-
</div>
|
311
|
-
</div>
|
312
|
-
<div class='method public-instance' id='method-M000139'>
|
313
|
-
<a name='M000139'></a>
|
314
|
-
<div class='synopsis'>
|
315
|
-
<span class='name'>test_characters_unicode</span>
|
316
|
-
<span class='arguments'>()</span>
|
317
|
-
</div>
|
318
|
-
<div class='source'>
|
319
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000139-source'); return false">
|
320
|
-
[show source]
|
321
|
-
</a>
|
322
|
-
<pre id='M000139-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 197</span>
197: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_characters_unicode</span>
198: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
199: 
200: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char8"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"日"</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>) <span class="ruby-comment cmt"># \u65e5</span>
201: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char9"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"여"</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>) <span class="ruby-comment cmt"># \uc5ec</span>
202: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"char10"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"з"</span>, <span class="ruby-constant">CHARACTER_DECLARATIONS</span>) <span class="ruby-comment cmt"># \u0437</span>
203: <span class="ruby-keyword kw">end</span></pre>
|
323
|
-
</div>
|
324
|
-
</div>
|
325
|
-
<div class='method public-instance' id='method-M000151'>
|
326
|
-
<a name='M000151'></a>
|
327
|
-
<div class='synopsis'>
|
328
|
-
<span class='name'>test_children</span>
|
329
|
-
<span class='arguments'>()</span>
|
330
|
-
</div>
|
331
|
-
<div class='source'>
|
332
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000151-source'); return false">
|
333
|
-
[show source]
|
334
|
-
</a>
|
335
|
-
<pre id='M000151-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 482</span>
482: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_children</span>
483: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
484: <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"parent"</span>)
485: 
486: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">size</span>, <span class="ruby-value">2</span>, <span class="ruby-constant">CHILDREN</span>)
487: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">name</span>, <span class="ruby-value str">"daughter"</span>, <span class="ruby-constant">CHILDREN</span>)
488: 
489: <span class="ruby-identifier">grandparent</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"grandparent"</span>)
490: 
491: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">grandparent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">size</span>, <span class="ruby-value">2</span>, <span class="ruby-constant">CHILDREN</span>)
492: <span class="ruby-comment cmt"># recursive fetch of children</span>
493: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">grandparent</span>.<span class="ruby-identifier">children</span>(<span class="ruby-keyword kw">true</span>).<span class="ruby-identifier">size</span>, <span class="ruby-value">6</span>, <span class="ruby-constant">CHILDREN</span>)
494: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">grandparent</span>.<span class="ruby-identifier">children</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"son"</span>).<span class="ruby-identifier">size</span>, <span class="ruby-value">2</span>, <span class="ruby-constant">CHILDREN</span>)
495: 
496: <span class="ruby-identifier">grandparent2</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"grandparent2"</span>)
497: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">grandparent2</span>.<span class="ruby-identifier">children</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"child"</span>).<span class="ruby-identifier">size</span>, <span class="ruby-value">5</span>, <span class="ruby-constant">CHILDREN</span>)
498: <span class="ruby-identifier">assert_equal</span>(
499: <span class="ruby-identifier">grandparent2</span>.<span class="ruby-identifier">child</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"daughter"</span>).<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">"birthday"</span>),
500: <span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1976</span>,<span class="ruby-value">04</span>,<span class="ruby-value">18</span>),
501: <span class="ruby-constant">CHILDREN</span>)
502: 
503: <span class="ruby-identifier">files</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"files"</span>)
504: 
505: <span class="ruby-identifier">assert_equal</span>(
506: [<span class="ruby-value str">"c:/file1.txt"</span>, <span class="ruby-value str">"c:/file2.txt"</span>, <span class="ruby-value str">"c:/folder"</span>],
507: <span class="ruby-identifier">files</span>.<span class="ruby-identifier">children_values</span>(<span class="ruby-value str">"content"</span>),
508: <span class="ruby-constant">CHILDREN</span>)
509: 
510: <span class="ruby-identifier">matrix</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"matrix"</span>)
511: 
512: <span class="ruby-identifier">assert_equal</span>([[<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>],[<span class="ruby-value">4</span>,<span class="ruby-value">5</span>,<span class="ruby-value">6</span>]], <span class="ruby-identifier">matrix</span>.<span class="ruby-identifier">children_values</span>(<span class="ruby-value str">"content"</span>), <span class="ruby-constant">CHILDREN</span>);
513: <span class="ruby-keyword kw">end</span></pre>
|
336
|
-
</div>
|
337
|
-
</div>
|
338
|
-
<div class='method public-instance' id='method-M000145'>
|
339
|
-
<a name='M000145'></a>
|
340
|
-
<div class='synopsis'>
|
341
|
-
<span class='name'>test_date_times</span>
|
342
|
-
<span class='arguments'>()</span>
|
343
|
-
</div>
|
344
|
-
<div class='source'>
|
345
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000145-source'); return false">
|
346
|
-
[show source]
|
347
|
-
</a>
|
348
|
-
<pre id='M000145-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 300</span>
300: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_date_times</span>
301: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
302: <span class="ruby-identifier">local_offset</span> = <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">offset</span>
303: 
304: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time1"</span>).<span class="ruby-identifier">value</span>,
305: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>,<span class="ruby-value">12</span>,<span class="ruby-value">31</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
306: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time2"</span>).<span class="ruby-identifier">value</span>,
307: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>,<span class="ruby-value">5</span>,<span class="ruby-value">2</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
308: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time3"</span>).<span class="ruby-identifier">value</span>,
309: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>,<span class="ruby-value">12</span>,<span class="ruby-value">31</span>,<span class="ruby-value">1</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
310: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time4"</span>).<span class="ruby-identifier">value</span>,
311: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>,<span class="ruby-value">5</span>,<span class="ruby-value">2</span>,<span class="ruby-value">1</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
312: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time5"</span>).<span class="ruby-identifier">value</span>,
313: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>,<span class="ruby-value">12</span>,<span class="ruby-value">31</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">2312</span>.<span class="ruby-identifier">to_r</span><span class="ruby-operator">/</span><span class="ruby-value">100</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
314: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time6"</span>).<span class="ruby-identifier">value</span>,
315: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>,<span class="ruby-value">5</span>,<span class="ruby-value">2</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23123</span>.<span class="ruby-identifier">to_r</span><span class="ruby-operator">/</span><span class="ruby-value">1000</span>, <span class="ruby-identifier">local_offset</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
316: 
317: <span class="ruby-comment cmt"># Checking timezones...</span>
318: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time7"</span>).<span class="ruby-identifier">value</span>,
319: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>,<span class="ruby-value">5</span>,<span class="ruby-value">2</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23123</span>.<span class="ruby-identifier">to_r</span><span class="ruby-operator">/</span><span class="ruby-value">1000</span>,<span class="ruby-value str">"JST"</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
320: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date_time8"</span>).<span class="ruby-identifier">value</span>,
321: <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">985</span>,<span class="ruby-value">04</span>,<span class="ruby-value">11</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23123</span>.<span class="ruby-identifier">to_r</span><span class="ruby-operator">/</span><span class="ruby-value">1000</span>,<span class="ruby-value str">"PST"</span>), <span class="ruby-constant">DATE_TIME_DECLARATIONS</span>)
322: <span class="ruby-keyword kw">end</span></pre>
|
349
|
-
</div>
|
350
|
-
</div>
|
351
|
-
<div class='method public-instance' id='method-M000143'>
|
352
|
-
<a name='M000143'></a>
|
353
|
-
<div class='synopsis'>
|
354
|
-
<span class='name'>test_dates</span>
|
355
|
-
<span class='arguments'>()</span>
|
356
|
-
</div>
|
357
|
-
<div class='source'>
|
358
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000143-source'); return false">
|
359
|
-
[show source]
|
360
|
-
</a>
|
361
|
-
<pre id='M000143-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 254</span>
254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_dates</span>
255: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
256: 
257: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>, <span class="ruby-value">12</span>, <span class="ruby-value">31</span>), <span class="ruby-constant">DATE_DECLARATIONS</span>)
258: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>, <span class="ruby-value">5</span>, <span class="ruby-value">2</span>), <span class="ruby-constant">DATE_DECLARATIONS</span>)
259: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"date3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1882</span>, <span class="ruby-value">5</span>, <span class="ruby-value">2</span>), <span class="ruby-constant">DATE_DECLARATIONS</span>)
260: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"_way_back"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">582</span>, <span class="ruby-value">9</span>, <span class="ruby-value">16</span>), <span class="ruby-constant">DATE_DECLARATIONS</span>)
261: <span class="ruby-keyword kw">end</span></pre>
|
362
|
-
</div>
|
363
|
-
</div>
|
364
|
-
<div class='method public-instance' id='method-M000147'>
|
365
|
-
<a name='M000147'></a>
|
366
|
-
<div class='synopsis'>
|
367
|
-
<span class='name'>test_empty_tag</span>
|
368
|
-
<span class='arguments'>()</span>
|
369
|
-
</div>
|
370
|
-
<div class='description'>
|
371
|
-
<p>
|
372
|
-
Structure Tests (values, attributes, children)
|
373
|
-
</p>
|
374
|
-
</div>
|
375
|
-
<div class='source'>
|
376
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000147-source'); return false">
|
377
|
-
[show source]
|
378
|
-
</a>
|
379
|
-
<pre id='M000147-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 348</span>
348: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_empty_tag</span>
349: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
350: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"empty_tag"</span>), <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"empty_tag"</span>), <span class="ruby-constant">EMPTY_TAG</span>)
351: <span class="ruby-keyword kw">end</span></pre>
|
380
|
-
</div>
|
381
|
-
</div>
|
382
|
-
<div class='method public-instance' id='method-M000152'>
|
383
|
-
<a name='M000152'></a>
|
384
|
-
<div class='synopsis'>
|
385
|
-
<span class='name'>test_namespaces</span>
|
386
|
-
<span class='arguments'>()</span>
|
387
|
-
</div>
|
388
|
-
<div class='source'>
|
389
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000152-source'); return false">
|
390
|
-
[show source]
|
391
|
-
</a>
|
392
|
-
<pre id='M000152-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 515</span>
515: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_namespaces</span>
516: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
517: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">8</span>, <span class="ruby-identifier">root</span>.<span class="ruby-identifier">children</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"person"</span>, <span class="ruby-keyword kw">nil</span>).<span class="ruby-identifier">size</span>, <span class="ruby-constant">NAMESPACES</span>);
518: 
519: <span class="ruby-identifier">grandparent2</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"grandparent3"</span>);
520: 
521: <span class="ruby-comment cmt"># get only the attributes for Akiko in the public namespace</span>
522: <span class="ruby-identifier">assert_equal</span>(
523: <span class="ruby-identifier">grandparent2</span>.<span class="ruby-identifier">child</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"daughter"</span>).<span class="ruby-identifier">attributes</span>(<span class="ruby-value str">"public"</span>),
524: {<span class="ruby-value str">"name"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"Akiko"</span>, <span class="ruby-value str">"birthday"</span>=<span class="ruby-operator">></span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1976</span>,<span class="ruby-value">04</span>,<span class="ruby-value">18</span>)},
525: <span class="ruby-constant">NAMESPACES</span>);
526: <span class="ruby-keyword kw">end</span></pre>
|
393
|
-
</div>
|
394
|
-
</div>
|
395
|
-
<div class='method public-instance' id='method-M000142'>
|
396
|
-
<a name='M000142'></a>
|
397
|
-
<div class='synopsis'>
|
398
|
-
<span class='name'>test_null</span>
|
399
|
-
<span class='arguments'>()</span>
|
400
|
-
</div>
|
401
|
-
<div class='source'>
|
402
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000142-source'); return false">
|
403
|
-
[show source]
|
404
|
-
</a>
|
405
|
-
<pre id='M000142-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 248</span>
248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_null</span>
249: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
250: 
251: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"nothing"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">NULL_DECLARATION</span>);
252: <span class="ruby-keyword kw">end</span></pre>
|
406
|
-
</div>
|
407
|
-
</div>
|
408
|
-
<div class='method public-instance' id='method-M000140'>
|
409
|
-
<a name='M000140'></a>
|
410
|
-
<div class='synopsis'>
|
411
|
-
<span class='name'>test_numbers</span>
|
412
|
-
<span class='arguments'>()</span>
|
413
|
-
</div>
|
414
|
-
<div class='source'>
|
415
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000140-source'); return false">
|
416
|
-
[show source]
|
417
|
-
</a>
|
418
|
-
<pre id='M000140-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 205</span>
205: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_numbers</span>
206: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
207: 
208: <span class="ruby-comment cmt"># Testing ints...</span>
209: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"int1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">0</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
210: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"int2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">5</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
211: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"int3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">-100</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
212: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"int4"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">234253532</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
213: 
214: <span class="ruby-comment cmt"># Testing longs...</span>
215: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"long1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">0</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
216: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"long2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">5</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
217: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"long3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">5</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
218: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"long4"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">3904857398753453453</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
219: 
220: <span class="ruby-comment cmt"># Testing floats...</span>
221: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"float1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">1</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
222: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"float2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">0</span><span class="ruby-value">.23</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
223: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"float3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">-0</span><span class="ruby-value">.34</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
224: 
225: <span class="ruby-comment cmt"># Testing doubles..."</span>
226: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"double1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">2</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
227: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"double2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">-0</span><span class="ruby-value">.234</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
228: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"double3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">2.34</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>)
229: 
230: <span class="ruby-comment cmt"># Testing decimals (BigDouble in Java)...</span>
231: <span class="ruby-identifier">assert_equal</span>(
232: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"decimal1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">0</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>);
233: <span class="ruby-identifier">assert_equal</span>(
234: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"decimal2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">11.111111</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>);
235: <span class="ruby-identifier">assert_equal</span>(
236: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"decimal3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value">234535.3453453453454345345341242343</span>, <span class="ruby-constant">NUMBER_DECLARATIONS</span>);
237: <span class="ruby-keyword kw">end</span></pre>
|
419
|
-
</div>
|
420
|
-
</div>
|
421
|
-
<div class='method public-instance' id='method-M000137'>
|
422
|
-
<a name='M000137'></a>
|
423
|
-
<div class='synopsis'>
|
424
|
-
<span class='name'>test_strings</span>
|
425
|
-
<span class='arguments'>()</span>
|
426
|
-
</div>
|
427
|
-
<div class='description'>
|
428
|
-
<p>
|
429
|
-
Basic Types Tests
|
430
|
-
</p>
|
431
|
-
</div>
|
432
|
-
<div class='source'>
|
433
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000137-source'); return false">
|
434
|
-
[show source]
|
435
|
-
</a>
|
436
|
-
<pre id='M000137-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 156</span>
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_strings</span>
157: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
158: 
159: <span class="ruby-comment cmt"># Doing String tests...</span>
160: <span class="ruby-comment cmt"># Doing basic tests including new line handling...</span>
161: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"hello"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
162: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"hi"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
163: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"aloha"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
164: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string4"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"hi there"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
165: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string5"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"hi there joe"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
166: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string6"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"line1\nline2"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
167: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string7"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"line1\nline2"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
168: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string8"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"line1\nline2\nline3"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
169: <span class="ruby-identifier">assert_equal</span>(
170: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string9"</span>).<span class="ruby-identifier">value</span>,
171: <span class="ruby-value str">"Anything should go in this line without escapes \\ \\\\ \\n "</span> <span class="ruby-operator">+</span>
172: <span class="ruby-value str">"\\t \" \"\" ' ''"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
173: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"string10"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"escapes \"\\\n\t"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
174: 
175: <span class="ruby-comment cmt"># Checking unicode strings...</span>
176: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"japanese.hello"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"日本語"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
177: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"korean.hello"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"여보세요"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
178: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"russian.hello"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"здравствулте"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
179: 
180: <span class="ruby-comment cmt"># More new line tests...</span>
181: <span class="ruby-identifier">assert</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"xml"</span>).<span class="ruby-identifier">value</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">"<text>Hi there!</text>"</span>) <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
182: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"line_test"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-value str">"\nnew line above and below\n"</span>, <span class="ruby-constant">STRING_DECLARATIONS</span>)
183: <span class="ruby-keyword kw">end</span></pre>
|
437
|
-
</div>
|
438
|
-
</div>
|
439
|
-
<div class='method public-instance' id='method-M000133'>
|
440
|
-
<a name='M000133'></a>
|
441
|
-
<div class='synopsis'>
|
442
|
-
<span class='name'>test_tag</span>
|
443
|
-
<span class='arguments'>()</span>
|
444
|
-
</div>
|
445
|
-
<div class='description'>
|
446
|
-
<p>
|
447
|
-
<a href="Tag.html">Tag</a> Tests
|
448
|
-
</p>
|
449
|
-
</div>
|
450
|
-
<div class='source'>
|
451
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000133-source'); return false">
|
452
|
-
[show source]
|
453
|
-
</a>
|
454
|
-
<pre id='M000133-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 95</span>
 95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_tag</span>
 96: <span class="ruby-comment cmt"># Test to make sure Tag ignores the order in which attributes are</span>
 97: <span class="ruby-comment cmt"># added.</span>
 98: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"test"</span>)
 99: <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"foo"</span>, <span class="ruby-value str">"bar"</span>)
100: <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"john"</span>, <span class="ruby-value str">"doe"</span>)
101: 
102: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"test"</span>)
103: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"john"</span>, <span class="ruby-value str">"doe"</span>)
104: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"foo"</span>, <span class="ruby-value str">"bar"</span>)
105: 
106: <span class="ruby-identifier">assert_tags_equal</span>(<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span>, <span class="ruby-constant">TAG</span>)
107: 
108: <span class="ruby-comment cmt"># Making sure tags with different structures return false from .equals</span>
109: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">value</span> = <span class="ruby-value str">"item"</span>
110: <span class="ruby-identifier">assert_not_equal</span>(<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span>, <span class="ruby-constant">TAG</span>)
111: 
112: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">remove_value</span>(<span class="ruby-value str">"item"</span>)
113: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"another"</span>, <span class="ruby-value str">"attribute"</span>)
114: <span class="ruby-identifier">assert_not_equal</span>(<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span>, <span class="ruby-constant">TAG</span>)
115: 
116: <span class="ruby-comment cmt"># Checking attributes namespaces</span>
117: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"name"</span>, <span class="ruby-value str">"bill"</span>)
118: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"private"</span>, <span class="ruby-value str">"smoker"</span>, <span class="ruby-keyword kw">true</span>)
119: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"public"</span>, <span class="ruby-value str">"hobby"</span>, <span class="ruby-value str">"hiking"</span>)
120: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">set_attribute</span>(<span class="ruby-value str">"private"</span>, <span class="ruby-value str">"nickname"</span>, <span class="ruby-value str">"tubby"</span>)
121: 
122: <span class="ruby-identifier">assert_equal</span>(
123: <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">attributes</span>(<span class="ruby-value str">"private"</span>),
124: { <span class="ruby-value str">"smoker"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"nickname"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"tubby"</span> },
125: <span class="ruby-value str">"attributes()"</span>)
126: <span class="ruby-keyword kw">end</span></pre>
|
455
|
-
</div>
|
456
|
-
</div>
|
457
|
-
<div class='method public-instance' id='method-M000134'>
|
458
|
-
<a name='M000134'></a>
|
459
|
-
<div class='synopsis'>
|
460
|
-
<span class='name'>test_tag_write_parse_basic_types</span>
|
461
|
-
<span class='arguments'>()</span>
|
462
|
-
</div>
|
463
|
-
<div class='source'>
|
464
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000134-source'); return false">
|
465
|
-
[show source]
|
466
|
-
</a>
|
467
|
-
<pre id='M000134-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 128</span>
128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_tag_write_parse_basic_types</span>
129: <span class="ruby-identifier">check_tag_write_parse</span> <span class="ruby-ivar">@@root_basic_types</span>
130: <span class="ruby-keyword kw">end</span></pre>
|
468
|
-
</div>
|
469
|
-
</div>
|
470
|
-
<div class='method public-instance' id='method-M000135'>
|
471
|
-
<a name='M000135'></a>
|
472
|
-
<div class='synopsis'>
|
473
|
-
<span class='name'>test_tag_write_parse_structures</span>
|
474
|
-
<span class='arguments'>()</span>
|
475
|
-
</div>
|
476
|
-
<div class='source'>
|
477
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000135-source'); return false">
|
478
|
-
[show source]
|
479
|
-
</a>
|
480
|
-
<pre id='M000135-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 132</span>
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_tag_write_parse_structures</span>
133: <span class="ruby-identifier">check_tag_write_parse</span> <span class="ruby-ivar">@@root_structures</span>
134: <span class="ruby-keyword kw">end</span></pre>
|
481
|
-
</div>
|
482
|
-
</div>
|
483
|
-
<div class='method public-instance' id='method-M000144'>
|
484
|
-
<a name='M000144'></a>
|
485
|
-
<div class='synopsis'>
|
486
|
-
<span class='name'>test_time_spans</span>
|
487
|
-
<span class='arguments'>()</span>
|
488
|
-
</div>
|
489
|
-
<div class='source'>
|
490
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000144-source'); return false">
|
491
|
-
[show source]
|
492
|
-
</a>
|
493
|
-
<pre id='M000144-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 263</span>
263: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_time_spans</span>
264: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_basic_types</span>
265: 
266: <span class="ruby-identifier">assert_equal</span>(
267: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time1"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
268: <span class="ruby-identifier">assert_equal</span>(
269: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time2"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">24</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
270: <span class="ruby-identifier">assert_equal</span>(
271: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time3"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">1</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
272: <span class="ruby-identifier">assert_equal</span>(
273: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time4"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">1</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
274: <span class="ruby-identifier">assert_equal</span>(
275: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time5"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">2</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
276: <span class="ruby-identifier">assert_equal</span>(
277: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time6"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
278: <span class="ruby-identifier">assert_equal</span>(
279: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time7"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">100</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
280: <span class="ruby-identifier">assert_equal</span>(
281: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time8"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">120</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
282: <span class="ruby-identifier">assert_equal</span>(
283: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time9"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">123</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
284: 
285: <span class="ruby-comment cmt"># Checking time spans with days...</span>
286: <span class="ruby-identifier">assert_equal</span>(
287: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time10"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">34</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">100</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
288: <span class="ruby-identifier">assert_equal</span>(
289: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time11"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
290: <span class="ruby-identifier">assert_equal</span>(
291: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time12"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">5</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">23</span>,<span class="ruby-value">123</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
292: 
293: <span class="ruby-comment cmt"># Checking negative time spans...</span>
294: <span class="ruby-identifier">assert_equal</span>(
295: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time13"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">-12</span>,<span class="ruby-value">-30</span>,<span class="ruby-value">-23</span>,<span class="ruby-value">-123</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
296: <span class="ruby-identifier">assert_equal</span>(
297: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"time14"</span>).<span class="ruby-identifier">value</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">-5</span>,<span class="ruby-value">-12</span>,<span class="ruby-value">-30</span>,<span class="ruby-value">-23</span>,<span class="ruby-value">-123</span>), <span class="ruby-constant">TIME_SPAN_DECLARATIONS</span>)
298: <span class="ruby-keyword kw">end</span></pre>
|
494
|
-
</div>
|
495
|
-
</div>
|
496
|
-
<div class='method public-instance' id='method-M000148'>
|
497
|
-
<a name='M000148'></a>
|
498
|
-
<div class='synopsis'>
|
499
|
-
<span class='name'>test_values</span>
|
500
|
-
<span class='arguments'>()</span>
|
501
|
-
</div>
|
502
|
-
<div class='source'>
|
503
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000148-source'); return false">
|
504
|
-
[show source]
|
505
|
-
</a>
|
506
|
-
<pre id='M000148-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 353</span>
353: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_values</span>
354: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
355: <span class="ruby-identifier">local_offset</span> = <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">offset</span>
356: 
357: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values1"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"hi"</span>], <span class="ruby-constant">VALUES</span>)
358: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values2"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"hi"</span>,<span class="ruby-value str">"ho"</span>], <span class="ruby-constant">VALUES</span>)
359: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values3"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>, <span class="ruby-value str">"ho"</span>], <span class="ruby-constant">VALUES</span>)
360: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values4"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"hi"</span>,<span class="ruby-value">5</span>], <span class="ruby-constant">VALUES</span>)
361: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values5"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>], <span class="ruby-constant">VALUES</span>)
362: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values6"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>], <span class="ruby-constant">VALUES</span>)
363: <span class="ruby-identifier">assert_equal</span>(
364: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values7"</span>).<span class="ruby-identifier">values</span>,
365: [<span class="ruby-keyword kw">nil</span>,<span class="ruby-value str">"foo"</span>,<span class="ruby-keyword kw">false</span>,<span class="ruby-constant">Date</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1980</span>,<span class="ruby-value">12</span>,<span class="ruby-value">5</span>)],
366: <span class="ruby-constant">VALUES</span>)
367: <span class="ruby-identifier">assert_equal</span>(
368: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values8"</span>).<span class="ruby-identifier">values</span>,
369: [<span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"foo"</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1980</span>,<span class="ruby-value">12</span>,<span class="ruby-value">5</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-identifier">local_offset</span>),
370: <span class="ruby-value str">"there"</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">15</span>,<span class="ruby-value">23</span>,<span class="ruby-value">12</span>,<span class="ruby-value">234</span>)],
371: <span class="ruby-constant">VALUES</span>)
372: <span class="ruby-identifier">assert_equal</span>(
373: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values9"</span>).<span class="ruby-identifier">values</span>,
374: [<span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"foo"</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1980</span>,<span class="ruby-value">12</span>,<span class="ruby-value">5</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-identifier">local_offset</span>),
375: <span class="ruby-value str">"there"</span>, <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1989</span>,<span class="ruby-value">8</span>,<span class="ruby-value">12</span>,<span class="ruby-value">15</span>,<span class="ruby-value">23</span>,<span class="ruby-value">12234</span>.<span class="ruby-identifier">to_r</span><span class="ruby-operator">/</span><span class="ruby-value">1000</span>,<span class="ruby-value str">"JST"</span>)],
376: <span class="ruby-constant">VALUES</span>)
377: <span class="ruby-identifier">assert_equal</span>(
378: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values10"</span>).<span class="ruby-identifier">values</span>,
379: [<span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"foo"</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1980</span>,<span class="ruby-value">12</span>,<span class="ruby-value">5</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-identifier">local_offset</span>),
380: <span class="ruby-value str">"there"</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>,<span class="ruby-value">15</span>,<span class="ruby-value">23</span>,<span class="ruby-value">12</span>,<span class="ruby-value">234</span>), <span class="ruby-value str">"more stuff"</span>],
381: <span class="ruby-constant">VALUES</span>)
382: <span class="ruby-identifier">assert_equal</span>(
383: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values11"</span>).<span class="ruby-identifier">values</span>,
384: [<span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">"foo"</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">1980</span>,<span class="ruby-value">12</span>,<span class="ruby-value">5</span>,<span class="ruby-value">12</span>,<span class="ruby-value">30</span>,<span class="ruby-value">0</span>,<span class="ruby-identifier">local_offset</span>),
385: <span class="ruby-value str">"there"</span>, <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">123</span>,<span class="ruby-value">15</span>,<span class="ruby-value">23</span>,<span class="ruby-value">12</span>,<span class="ruby-value">234</span>), <span class="ruby-value str">"more stuff here"</span>],
386: <span class="ruby-constant">VALUES</span>)
387: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values12"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>], <span class="ruby-constant">VALUES</span>)
388: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values13"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>], <span class="ruby-constant">VALUES</span>)
389: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values14"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>], <span class="ruby-constant">VALUES</span>)
390: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values15"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">4</span>,<span class="ruby-value">5</span>,<span class="ruby-value">6</span>], <span class="ruby-constant">VALUES</span>)
391: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values16"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">5</span>], <span class="ruby-constant">VALUES</span>)
392: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values17"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">5</span>], <span class="ruby-constant">VALUES</span>)
393: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values18"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">7</span>], <span class="ruby-constant">VALUES</span>)
394: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values19"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>,<span class="ruby-value">5</span>,<span class="ruby-value">7</span>], <span class="ruby-constant">VALUES</span>)
395: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values20"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>,<span class="ruby-value">5</span>], <span class="ruby-constant">VALUES</span>)
396: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values21"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value">1</span>,<span class="ruby-value">3</span>,<span class="ruby-value">5</span>], <span class="ruby-constant">VALUES</span>)
397: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"values22"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"hi"</span>,<span class="ruby-value str">"ho"</span>,<span class="ruby-value str">"ho"</span>,<span class="ruby-value">5</span>,<span class="ruby-value str">"hi"</span>], <span class="ruby-constant">VALUES</span>)
398: <span class="ruby-keyword kw">end</span></pre>
|
507
|
-
</div>
|
508
|
-
</div>
|
509
|
-
<div class='method public-instance' id='method-M000150'>
|
510
|
-
<a name='M000150'></a>
|
511
|
-
<div class='synopsis'>
|
512
|
-
<span class='name'>test_values_and_attributes</span>
|
513
|
-
<span class='arguments'>()</span>
|
514
|
-
</div>
|
515
|
-
<div class='source'>
|
516
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000150-source'); return false">
|
517
|
-
[show source]
|
518
|
-
</a>
|
519
|
-
<pre id='M000150-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl4r_test.rb, line 425</span>
425: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_values_and_attributes</span>
426: <span class="ruby-identifier">root</span> = <span class="ruby-ivar">@@root_structures</span>
427: 
428: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts1"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
429: <span class="ruby-identifier">assert_equal</span>(
430: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts1"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>}, <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
431: 
432: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts2"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
433: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts2"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>}, <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
434: 
435: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts3"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
436: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts3"</span>).<span class="ruby-identifier">attributes</span>, {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>}, <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
437: 
438: <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts4"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
439: <span class="ruby-identifier">assert_equal</span>(
440: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts4"</span>).<span class="ruby-identifier">attributes</span>,
441: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"weight"</span>=<span class="ruby-operator">></span><span class="ruby-value">160</span>, <span class="ruby-value str">"hat"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"big"</span>},
442: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
443: 
444: <span class="ruby-identifier">assert_equal</span>(
445: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts5"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>, <span class="ruby-value str">"is a\n nice guy"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
446: <span class="ruby-identifier">assert_equal</span>(
447: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts5"</span>).<span class="ruby-identifier">attributes</span>,
448: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>},
449: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>);
450: 
451: <span class="ruby-identifier">assert_equal</span>(
452: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts6"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>, <span class="ruby-value str">"is a\n nice guy"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
453: <span class="ruby-identifier">assert_equal</span>(
454: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts6"</span>).<span class="ruby-identifier">attributes</span>,
455: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"house"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"big and\n blue"</span>},
456: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
457: 
458: <span class="ruby-comment cmt">#####</span>
459: 
460: <span class="ruby-identifier">assert_equal</span>(
461: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts7"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>, <span class="ruby-value str">"is a\n nice guy"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
462: <span class="ruby-identifier">assert_equal</span>(
463: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts7"</span>).<span class="ruby-identifier">attributes</span>,
464: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>},
465: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
466: 
467: <span class="ruby-identifier">assert_equal</span>(
468: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts8"</span>).<span class="ruby-identifier">values</span>, [<span class="ruby-value str">"joe"</span>, <span class="ruby-value str">"is a\n nice guy"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
469: <span class="ruby-identifier">assert_equal</span>(
470: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts8"</span>).<span class="ruby-identifier">attributes</span>,
471: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>},
472: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>);
473: 
474: <span class="ruby-identifier">assert_equal</span>(
475: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts9"</span>).<span class="ruby-identifier">values</span>,[<span class="ruby-value str">"joe"</span>, <span class="ruby-value str">"is a\n nice guy"</span>], <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
476: <span class="ruby-identifier">assert_equal</span>(
477: <span class="ruby-identifier">root</span>.<span class="ruby-identifier">child</span>(<span class="ruby-value str">"valatts9"</span>).<span class="ruby-identifier">attributes</span>,
478: {<span class="ruby-value str">"size"</span>=<span class="ruby-operator">></span><span class="ruby-value">5</span>, <span class="ruby-value str">"smoker"</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>},
479: <span class="ruby-constant">VALUES_AND_ATTRIBUTES</span>)
480: <span class="ruby-keyword kw">end</span></pre>
|
520
|
-
</div>
|
521
|
-
</div>
|
522
|
-
</div>
|
523
|
-
</div>
|
524
|
-
</div>
|
525
|
-
</div>
|
526
|
-
<div id='footer-push'></div>
|
527
|
-
</div>
|
528
|
-
<div id='footer'>
|
529
|
-
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
530
|
-
</div>
|
531
|
-
</body>
|
532
|
-
</html>
|