sicl 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,451 +1,465 @@
1
- #!/usr/bin/ruby
2
- ################################################################################
3
- #
4
- # Copyright (c) 2005-2006 Naoki Kobayashi
5
- #
6
- # This library is free software.
7
- # You can distribute/modify this script under the same terms of ruby.
8
- #
9
- # $Header: $
10
- #
11
- ################################################################################
12
-
13
- Signal.trap(:USR2) {} if RUBY_PLATFORM =~ /hpux/ # workaround ...;|
14
-
15
- ################################################################################
16
- # OPTION SETTINGS
17
- ################################################################################
18
-
19
- require "optparse"
20
-
21
- Settings = Hash.new
22
- opts = OptionParser.new
23
- opts.on( "-a", "--address ADDRESS", String ) { |v| Settings[:address] = v }
24
- opts.on( "-d", "--debug", String ) { |v| Settings[:debug] = true }
25
- opts.parse!( ARGV )
26
-
27
- ################################################################################
28
- # PARAMETER VALIDATION
29
- ################################################################################
30
-
31
- address = Settings[:address]
32
- address = "gpib0,17" unless address
33
-
34
- ################################################################################
35
- # CLASS DECLARATION
36
- ################################################################################
37
-
38
- require "runit/testcase"
39
- require "runit/cui/testrunner"
40
- require "sicl"
41
-
42
- class TestSicl < RUNIT::TestCase
43
-
44
- def TestSicl.suite(address)
45
- @@address = address
46
- SICL.open(@@address) { |io| @@name = io.query("*IDN?") }
47
- puts "#{@@address} : #{@@name}" if Settings[:debug]
48
- super()
49
- end
50
-
51
- class MyInstrument < SICL::Instrument
52
-
53
- def initialize(addr)
54
- super(addr)
55
-
56
- reset
57
- end
58
-
59
- def reset
60
- output "*CLS"
61
- output "*RST"
62
- query "*ESR?"
63
- end
64
-
65
- def enable_srq_detection
66
- output "*SRE #{0x20}"
67
- output "*ESE #{0x3c}"
68
- end
69
-
70
- def disable_srq_detection
71
- output "*SRE #{0x00}"
72
- output "*ESE #{0x00}"
73
- end
74
-
75
- def raise_timeout(timeout=1000)
76
- self.timeout = timeout
77
- loop { break unless self.read }
78
- end
79
-
80
- def raise_srq(timeout=10)
81
- self.output "xxx"
82
- sleep timeout
83
- end
84
-
85
- end
86
-
87
- NO_ERROR = "No error"
88
- BAD_ADDRESS = "Bad address"
89
- TIMEOUT_OCCURRED = "Timeout occurred"
90
- INVALID_INST = "Invalid INST"
91
-
92
- ESR_BIT = 5 # Standard Event Register
93
- RQS_BIT = 6 # ReQuest Service
94
-
95
- def setup
96
- @io = MyInstrument.new @@address
97
- @name = @@name
98
- end
99
-
100
- def teardown
101
-
102
- begin
103
- if Settings[:debug] then
104
- @io.on_error { |err| puts "[ERR: #{err}]" }
105
- @io.on_srq { puts "[SRQ]" }
106
- @io.on_intr { |reason, secval| puts "[INTR: #{reason}, #{secval}]" }
107
- else
108
- @io.on_error = nil
109
- @io.on_srq = nil
110
- @io.on_intr = nil
111
- end
112
- @io.disable_srq_detection
113
- rescue
114
- # do nothing...
115
- end
116
-
117
- end
118
-
119
- def test_open0
120
- ret = SICL.open(@@address) { |io|
121
-
122
- res = io.write("*IDN?\n").read.chomp
123
- assert_equal @name, res
124
-
125
- res = io.output("*IDN?").enter
126
- assert_equal @name, res
127
-
128
- res = io.query("*IDN?")
129
- assert_equal @name, res
130
-
131
- io.address
132
- }
133
-
134
- assert_equal @@address, ret
135
- end
136
-
137
- def test_open1
138
- err = assert_exception(SICL::Error) { SICL.open("xxx") }
139
-
140
- assert_equal BAD_ADDRESS, err.message
141
- end
142
-
143
- def test_stb0
144
- @io.output("*SRE #{0x00}")
145
- @io.output("*ESE #{0x00}")
146
-
147
- rqs = @io.query("*STB?").to_i[RQS_BIT]
148
- assert_equal 0, rqs
149
- end
150
-
151
- def test_stb1
152
- @io.enable_srq_detection
153
-
154
- @io.output("xxx")
155
-
156
- sleep 0.1
157
-
158
- stb = @io.query("*STB?").to_i
159
-
160
- assert_equal 1, stb[ESR_BIT]
161
- assert_equal 1, stb[RQS_BIT]
162
- end
163
-
164
- def test_stb2
165
- @io.enable_srq_detection
166
-
167
- @io.output("xxx")
168
-
169
- sleep 1
170
-
171
- stb = @io.spoll
172
-
173
- assert_equal 1, stb[ESR_BIT]
174
- assert_equal 1, stb[RQS_BIT]
175
- end
176
-
177
- def test_typerr_error
178
- assert_exception(TypeError) { @io.on_error = "xxx" }
179
- end
180
-
181
- def test_typerr_srq
182
- assert_exception(TypeError) { @io.on_srq = "xxx" }
183
- end
184
-
185
- def test_typerr_intr
186
- assert_exception(TypeError) { @io.on_intr = "xxx" }
187
- end
188
-
189
- def test_srq0
190
- @io.enable_srq_detection
191
-
192
- srq_occured = false
193
-
194
- @io.on_srq { srq_occured = true }
195
-
196
- @io.output("xxx")
197
-
198
- 10.times { sleep 0.1 unless srq_occured }
199
-
200
- assert_equal true, srq_occured
201
- end
202
-
203
- def test_srq1
204
- @io.enable_srq_detection
205
-
206
- stb = 0
207
-
208
- @io.on_srq { sleep 1; stb = @io.spoll }
209
-
210
- @io.output("xxx")
211
-
212
- 10.times { sleep 0.1 if stb == 0 }
213
-
214
- assert_equal 1, stb[ESR_BIT]
215
- assert_equal 1, stb[RQS_BIT]
216
- end
217
-
218
- def test_typerr_write
219
- assert_exception(TypeError) { @io.write(10) }
220
- end
221
-
222
- def test_typerr_write_op
223
- assert_exception(TypeError) { @io << 10 }
224
- end
225
-
226
- def test_typerr_read
227
- assert_exception(TypeError) { @io.read("xxx") }
228
- end
229
-
230
- def test_typerr_output
231
- assert_exception(TypeError) { @io.output(10) }
232
- end
233
-
234
- def test_write_and_read0
235
- res = @io.write("*IDN?\n")
236
- assert res
237
-
238
- res = @io.read 1
239
- assert_equal @name[0].chr, res
240
- end
241
-
242
- def test_write_and_read1
243
- res = @io.write("*IDN?\n").read 1
244
- assert_equal @name[0].chr, res
245
- end
246
-
247
- def test_write_and_read2
248
- res = @io.write("*IDN?\n").read 7
249
- assert_equal @name[0...7], res
250
- end
251
-
252
- def test_write_and_read3
253
- res = @io.write("*I").write("DN").write("?\n").read 1
254
- assert_equal @name[0].chr, res
255
- end
256
-
257
- def test_write_and_read4
258
- @io << "*I" << "DN" << "?" << SICL::EOL
259
- res = @io.read 1
260
- assert_equal @name[0].chr, res
261
- end
262
-
263
- def test_write_and_read5
264
- @io << "*RST" << SICL::EOL << "*IDN?" << SICL::EOL
265
- res = @io.read 1
266
- assert_equal @name[0].chr, res
267
- end
268
-
269
- def test_output_and_enter0
270
- res = @io.output("*IDN?")
271
- assert res
272
- res = @io.enter
273
- assert_equal @name, res
274
- end
275
-
276
- def test_output_and_enter1
277
- res = @io.output("*IDN?").enter
278
- assert_equal @name, res
279
- end
280
-
281
- def test_output_and_enter2
282
- res = @io.output("*IDN?\r\n \r\r\r\r;;\n;;\r\n\n").enter
283
- assert_equal @name, res
284
- end
285
-
286
- def test_error_message0
287
- assert_equal NO_ERROR, SICL.errstr(0)
288
- end
289
-
290
- def test_error_message1
291
- assert SICL.errstr(15)
292
- end
293
-
294
- def test_error_message2
295
- assert_equal NO_ERROR, @io.errstr
296
- end
297
-
298
- def test_error_message3
299
- error_message = ''
300
-
301
- @io.on_error { |err| error_message = err[1] }
302
-
303
- @io.raise_timeout
304
-
305
- assert_equal TIMEOUT_OCCURRED, error_message
306
- end
307
-
308
- def test_error_message4
309
- error_message = ''
310
-
311
- @io.on_error {}
312
-
313
- @io.raise_timeout
314
-
315
- assert_equal TIMEOUT_OCCURRED, @io.errstr
316
- end
317
-
318
- def test_error_message5
319
- error_message = ''
320
-
321
- @io.on_error { |num, msg| error_message = msg }
322
-
323
- @io.raise_timeout
324
-
325
- assert_equal TIMEOUT_OCCURRED, error_message
326
- end
327
-
328
- def test_error_close0
329
- @io.close
330
- err = assert_exception(SICL::Error) { @io.close }
331
-
332
- assert_equal INVALID_INST, err.message
333
- end
334
-
335
- def test_error_close1
336
- @io.close
337
- err = assert_exception(SICL::Error) { @io.close }
338
-
339
- assert_equal INVALID_INST, err.message
340
- end
341
-
342
- def test_error_timeout0
343
- time_limit = 10000
344
-
345
- @io.timeout = time_limit
346
-
347
- assert_equal time_limit, @io.timeout
348
- end
349
-
350
- def test_error_timeout1
351
- err = assert_exception(SICL::Error) {
352
- @io.raise_timeout
353
- }
354
-
355
- assert_equal TIMEOUT_OCCURRED, err.message
356
- end
357
-
358
- def test_error_timeout2
359
- @io.on_error = lambda {}
360
-
361
- @io.raise_timeout
362
-
363
- assert true
364
- end
365
-
366
- def test_error_timeout3
367
- @io.on_error = lambda {}
368
- @io.on_error = nil
369
-
370
- err = assert_exception(SICL::Error) {
371
- @io.raise_timeout
372
- }
373
-
374
- assert_equal TIMEOUT_OCCURRED, err.message
375
- end
376
-
377
- def test_error_timeout4
378
- @io.on_error {}
379
-
380
- @io.raise_timeout
381
-
382
- assert true
383
- end
384
-
385
- def test_close
386
- assert @io.close
387
- end
388
-
389
- def test_abort
390
- assert @io.abort.instance_of?(@io.class) if @@address =~ /^[gh]pib/
391
- end
392
-
393
- def test_clear
394
- assert @io.clear.instance_of?(@io.class)
395
- end
396
-
397
- def test_spoll
398
- assert @io.spoll.instance_of?(Fixnum)
399
- end
400
-
401
- def test_readstb
402
- assert @io.readstb.instance_of?(Fixnum)
403
- end
404
-
405
- def test_local
406
- assert @io.local.instance_of?(@io.class)
407
- end
408
-
409
- def test_remote
410
- assert @io.remote.instance_of?(@io.class)
411
- end
412
-
413
- def test_flush0
414
- assert @io.flush.instance_of?(@io.class)
415
- end
416
-
417
- def test_flush1
418
- assert @io.flush(SICL::BUF_DISCARD_READ | SICL::BUF_DISCARD_WRITE)
419
- end
420
-
421
- def test_addr
422
- assert_equal @io.addr, @@address
423
- end
424
-
425
- def test_addr
426
- assert_equal @io.address, @@address
427
- end
428
-
429
- def test_typerr_termchr
430
- assert_exception(TypeError) { @io.termchr = " " }
431
- end
432
-
433
- def test_termchr0
434
- assert @io.termchr = 0x20
435
- assert_equal @io.termchr, 0x20
436
- end
437
-
438
- def test_termchr1
439
- assert @io.termchr = " "[0]
440
- assert_equal @io.termchr, 0x20
441
- end
442
-
443
- end
444
-
445
- ################################################################################
446
- # MAIN ROUTINE
447
- ################################################################################
448
-
449
- if $0 == __FILE__ then
450
- RUNIT::CUI::TestRunner.run(TestSicl.suite(address))
451
- end
1
+ #!/usr/bin/ruby
2
+ ################################################################################
3
+ #
4
+ # Copyright (c) 2005-2006 Naoki Kobayashi
5
+ #
6
+ # This library is free software.
7
+ # You can distribute/modify this script under the same terms of ruby.
8
+ #
9
+ # $LastChangedDate$
10
+ # $Revision$
11
+ # $Author$
12
+ #
13
+ ################################################################################
14
+
15
+ Signal.trap(:USR2) {} if RUBY_PLATFORM =~ /hpux/ # workaround ...;|
16
+
17
+ ################################################################################
18
+ # OPTION SETTINGS
19
+ ################################################################################
20
+
21
+ require "optparse"
22
+
23
+ Settings = Hash.new
24
+ opts = OptionParser.new
25
+ opts.on( "-a", "--address ADDRESS", String ) { |v| Settings[:address] = v }
26
+ opts.on( "-d", "--debug", String ) { |v| Settings[:debug] = true }
27
+ opts.parse!( ARGV )
28
+
29
+ ################################################################################
30
+ # PARAMETER VALIDATION
31
+ ################################################################################
32
+
33
+ address = Settings[:address]
34
+ address = "gpib0,17" unless address
35
+
36
+ ################################################################################
37
+ # CLASS DECLARATION
38
+ ################################################################################
39
+
40
+ require "runit/testcase"
41
+ require "runit/cui/testrunner"
42
+ require "sicl"
43
+
44
+ class TestSicl < RUNIT::TestCase
45
+
46
+ def TestSicl.suite(address)
47
+ @@address = address
48
+ SICL.open(@@address) { |io| @@name = io.query("*IDN?") }
49
+ puts "#{@@address} : #{@@name}" if Settings[:debug]
50
+ super()
51
+ end
52
+
53
+ class MyInstrument < SICL::Instrument
54
+
55
+ def initialize(addr)
56
+ super(addr)
57
+
58
+ reset
59
+ end
60
+
61
+ def reset
62
+ output "*CLS"
63
+ output "*RST"
64
+ query "*ESR?"
65
+ end
66
+
67
+ def enable_srq_detection
68
+ output "*SRE #{0x20}"
69
+ output "*ESE #{0x3c}"
70
+ end
71
+
72
+ def disable_srq_detection
73
+ output "*SRE #{0x00}"
74
+ output "*ESE #{0x00}"
75
+ end
76
+
77
+ def raise_timeout(timeout=1000)
78
+ self.timeout = timeout
79
+ loop { break unless self.read }
80
+ end
81
+
82
+ def raise_srq(timeout=10)
83
+ self.output "xxx"
84
+ sleep timeout
85
+ end
86
+
87
+ end
88
+
89
+ NO_ERROR = "No error"
90
+ BAD_ADDRESS = "Bad address"
91
+ TIMEOUT_OCCURRED = "Timeout occurred"
92
+ INVALID_INST = "Invalid INST"
93
+
94
+ ESR_BIT = 5 # Standard Event Register
95
+ RQS_BIT = 6 # ReQuest Service
96
+
97
+ def setup
98
+ @io = MyInstrument.new @@address
99
+ @name = @@name
100
+ end
101
+
102
+ def teardown
103
+
104
+ begin
105
+ if Settings[:debug] then
106
+ @io.on_error { |err| puts "[ERR: #{err}]" }
107
+ @io.on_srq { puts "[SRQ]" }
108
+ @io.on_intr { |reason, secval| puts "[INTR: #{reason}, #{secval}]" }
109
+ else
110
+ @io.on_error = nil
111
+ @io.on_srq = nil
112
+ @io.on_intr = nil
113
+ end
114
+ @io.disable_srq_detection
115
+ rescue
116
+ # do nothing...
117
+ end
118
+
119
+ end
120
+
121
+ def test_open0
122
+ ret = SICL.open(@@address) { |io|
123
+
124
+ res = io.query("*IDN?")
125
+ assert_equal @name, res
126
+
127
+ io.address
128
+ }
129
+
130
+ assert_equal @@address, ret
131
+ end
132
+
133
+ def test_open1
134
+ err = assert_exception(SICL::Error) { SICL.open("xxx") }
135
+
136
+ assert_equal BAD_ADDRESS, err.message
137
+ end
138
+
139
+ def test_open2
140
+ ret = SICL::Instrument.open(@@address) { |io|
141
+
142
+ res = io.query("*IDN?")
143
+ assert_equal @name, res
144
+
145
+ io.address
146
+ }
147
+
148
+ assert_equal @@address, ret
149
+ end
150
+
151
+ def test_open3
152
+ err = assert_exception(SICL::Error) { SICL::Instrument.open("xxx") }
153
+
154
+ assert_equal BAD_ADDRESS, err.message
155
+ end
156
+
157
+ def test_stb0
158
+ @io.output("*SRE #{0x00}")
159
+ @io.output("*ESE #{0x00}")
160
+
161
+ rqs = @io.query("*STB?").to_i[RQS_BIT]
162
+ assert_equal 0, rqs
163
+ end
164
+
165
+ def test_stb1
166
+ @io.enable_srq_detection
167
+
168
+ @io.output("xxx")
169
+
170
+ sleep 0.1
171
+
172
+ stb = @io.query("*STB?").to_i
173
+
174
+ assert_equal 1, stb[ESR_BIT]
175
+ assert_equal 1, stb[RQS_BIT]
176
+ end
177
+
178
+ def test_stb2
179
+ @io.enable_srq_detection
180
+
181
+ @io.output("xxx")
182
+
183
+ sleep 1
184
+
185
+ stb = @io.spoll
186
+
187
+ assert_equal 1, stb[ESR_BIT]
188
+ assert_equal 1, stb[RQS_BIT]
189
+ end
190
+
191
+ def test_typerr_error
192
+ assert_exception(TypeError) { @io.on_error = "xxx" }
193
+ end
194
+
195
+ def test_typerr_srq
196
+ assert_exception(TypeError) { @io.on_srq = "xxx" }
197
+ end
198
+
199
+ def test_typerr_intr
200
+ assert_exception(TypeError) { @io.on_intr = "xxx" }
201
+ end
202
+
203
+ def test_srq0
204
+ @io.enable_srq_detection
205
+
206
+ srq_occured = false
207
+
208
+ @io.on_srq { srq_occured = true }
209
+
210
+ @io.output("xxx")
211
+
212
+ 10.times { sleep 0.1 unless srq_occured }
213
+
214
+ assert_equal true, srq_occured
215
+ end
216
+
217
+ def test_srq1
218
+ @io.enable_srq_detection
219
+
220
+ stb = 0
221
+
222
+ @io.on_srq { sleep 1; stb = @io.spoll }
223
+
224
+ @io.output("xxx")
225
+
226
+ 10.times { sleep 0.1 if stb == 0 }
227
+
228
+ assert_equal 1, stb[ESR_BIT]
229
+ assert_equal 1, stb[RQS_BIT]
230
+ end
231
+
232
+ def test_typerr_write
233
+ assert_exception(TypeError) { @io.write(10) }
234
+ end
235
+
236
+ def test_typerr_write_op
237
+ assert_exception(TypeError) { @io << 10 }
238
+ end
239
+
240
+ def test_typerr_read
241
+ assert_exception(TypeError) { @io.read("xxx") }
242
+ end
243
+
244
+ def test_typerr_output
245
+ assert_exception(TypeError) { @io.output(10) }
246
+ end
247
+
248
+ def test_write_and_read0
249
+ res = @io.write("*IDN?\n")
250
+ assert res
251
+
252
+ res = @io.read 1
253
+ assert_equal @name[0].chr, res
254
+ end
255
+
256
+ def test_write_and_read1
257
+ res = @io.write("*IDN?\n").read 1
258
+ assert_equal @name[0].chr, res
259
+ end
260
+
261
+ def test_write_and_read2
262
+ res = @io.write("*IDN?\n").read 7
263
+ assert_equal @name[0...7], res
264
+ end
265
+
266
+ def test_write_and_read3
267
+ res = @io.write("*I").write("DN").write("?\n").read 1
268
+ assert_equal @name[0].chr, res
269
+ end
270
+
271
+ def test_write_and_read4
272
+ @io << "*I" << "DN" << "?" << SICL::EOL
273
+ res = @io.read 1
274
+ assert_equal @name[0].chr, res
275
+ end
276
+
277
+ def test_write_and_read5
278
+ @io << "*RST" << SICL::EOL << "*IDN?" << SICL::EOL
279
+ res = @io.read 1
280
+ assert_equal @name[0].chr, res
281
+ end
282
+
283
+ def test_output_and_enter0
284
+ res = @io.output("*IDN?")
285
+ assert res
286
+ res = @io.enter
287
+ assert_equal @name, res
288
+ end
289
+
290
+ def test_output_and_enter1
291
+ res = @io.output("*IDN?").enter
292
+ assert_equal @name, res
293
+ end
294
+
295
+ def test_output_and_enter2
296
+ res = @io.output("*IDN?\r\n \r\r\r\r;;\n;;\r\n\n").enter
297
+ assert_equal @name, res
298
+ end
299
+
300
+ def test_error_message0
301
+ assert_equal NO_ERROR, SICL::Error.errstr(0)
302
+ end
303
+
304
+ def test_error_message1
305
+ assert SICL::Error.errstr(15)
306
+ end
307
+
308
+ def test_error_message2
309
+ assert_equal NO_ERROR, @io.errstr
310
+ end
311
+
312
+ def test_error_message3
313
+ error_message = ''
314
+
315
+ @io.on_error { |err| error_message = err[1] }
316
+
317
+ @io.raise_timeout
318
+
319
+ assert_equal TIMEOUT_OCCURRED, error_message
320
+ end
321
+
322
+ def test_error_message4
323
+ error_message = ''
324
+
325
+ @io.on_error {}
326
+
327
+ @io.raise_timeout
328
+
329
+ assert_equal TIMEOUT_OCCURRED, @io.errstr
330
+ end
331
+
332
+ def test_error_message5
333
+ error_message = ''
334
+
335
+ @io.on_error { |num, msg| error_message = msg }
336
+
337
+ @io.raise_timeout
338
+
339
+ assert_equal TIMEOUT_OCCURRED, error_message
340
+ end
341
+
342
+ def test_error_close0
343
+ @io.close
344
+ err = assert_exception(SICL::Error) { @io.close }
345
+
346
+ assert_equal INVALID_INST, err.message
347
+ end
348
+
349
+ def test_error_close1
350
+ @io.close
351
+ err = assert_exception(SICL::Error) { @io.close }
352
+
353
+ assert_equal INVALID_INST, err.message
354
+ end
355
+
356
+ def test_error_timeout0
357
+ time_limit = 10000
358
+
359
+ @io.timeout = time_limit
360
+
361
+ assert_equal time_limit, @io.timeout
362
+ end
363
+
364
+ def test_error_timeout1
365
+ err = assert_exception(SICL::Error) {
366
+ @io.raise_timeout
367
+ }
368
+
369
+ assert_equal TIMEOUT_OCCURRED, err.message
370
+ end
371
+
372
+ def test_error_timeout2
373
+ @io.on_error = lambda {}
374
+
375
+ @io.raise_timeout
376
+
377
+ assert true
378
+ end
379
+
380
+ def test_error_timeout3
381
+ @io.on_error = lambda {}
382
+ @io.on_error = nil
383
+
384
+ err = assert_exception(SICL::Error) {
385
+ @io.raise_timeout
386
+ }
387
+
388
+ assert_equal TIMEOUT_OCCURRED, err.message
389
+ end
390
+
391
+ def test_error_timeout4
392
+ @io.on_error {}
393
+
394
+ @io.raise_timeout
395
+
396
+ assert true
397
+ end
398
+
399
+ def test_close
400
+ assert @io.close
401
+ end
402
+
403
+ def test_abort
404
+ assert @io.abort.instance_of?(@io.class) if @@address =~ /^[gh]pib/
405
+ end
406
+
407
+ def test_clear
408
+ assert @io.clear.instance_of?(@io.class)
409
+ end
410
+
411
+ def test_spoll
412
+ assert @io.spoll.instance_of?(Fixnum)
413
+ end
414
+
415
+ def test_readstb
416
+ assert @io.readstb.instance_of?(Fixnum)
417
+ end
418
+
419
+ def test_local
420
+ assert @io.local.instance_of?(@io.class)
421
+ end
422
+
423
+ def test_remote
424
+ assert @io.remote.instance_of?(@io.class)
425
+ end
426
+
427
+ def test_flush0
428
+ assert @io.flush.instance_of?(@io.class)
429
+ end
430
+
431
+ def test_flush1
432
+ assert @io.flush(SICL::BUF_DISCARD_READ | SICL::BUF_DISCARD_WRITE)
433
+ end
434
+
435
+ def test_addr
436
+ assert_equal @io.addr, @@address
437
+ end
438
+
439
+ def test_addr
440
+ assert_equal @io.address, @@address
441
+ end
442
+
443
+ def test_typerr_termchr
444
+ assert_exception(TypeError) { @io.termchr = " " }
445
+ end
446
+
447
+ def test_termchr0
448
+ assert @io.termchr = 0x20
449
+ assert_equal @io.termchr, 0x20
450
+ end
451
+
452
+ def test_termchr1
453
+ assert @io.termchr = " "[0]
454
+ assert_equal @io.termchr, 0x20
455
+ end
456
+
457
+ end
458
+
459
+ ################################################################################
460
+ # MAIN ROUTINE
461
+ ################################################################################
462
+
463
+ if $0 == __FILE__ then
464
+ RUNIT::CUI::TestRunner.run(TestSicl.suite(address))
465
+ end