/[eiffelstudio]/trunk/eweasel/tests/string001/test_string_8.e
ViewVC logotype

Contents of /trunk/eweasel/tests/string001/test_string_8.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100591 - (show annotations)
Sat Jul 8 08:14:06 2017 UTC (2 years, 6 months ago) by alexk
File size: 77544 byte(s)
Specified explicit manifest array type to avoid a warning that computed manifest array type does not conform to the target of reattachment.
1 class
2 TEST_STRING_8
3
4 create
5
6 make
7
8 feature {NONE} -- Initialization
9
10 make is
11 -- Execute test.
12 do
13 test_adapt
14 test_adapt_size
15 test_additional_space
16 test_append
17 test_append_boolean
18 test_append_character
19 test_append_double
20 test_append_integer
21 test_append_real
22 test_append_string
23 test_as_lower
24 test_as_upper
25 test_automatic_grow
26 test_center_justify
27 test_character_justify
28 test_copy
29 test_ends_with
30 test_extend
31 test_fill_blank
32 test_fill_character
33 test_fill_with
34 test_from_c
35 test_from_c_substring
36 test_fuzzy_index
37 test_grow
38 test_has
39 test_has_substring
40 test_hash_code
41 test_index_of
42 test_insert_character
43 test_insert_string
44 test_is_boolean
45 test_is_case_insensitive_equal
46 test_is_double
47 test_is_empty
48 test_is_equal
49 test_is_inserted
50 test_is_integer
51 test_is_real
52 test_infix_greater
53 test_infix_greater_or_equal
54 test_infix_less
55 test_infix_less_or_equal
56 test_infix_plus
57 test_keep_head
58 test_keep_tail
59 test_last_index_of
60 test_left_adjust
61 test_left_justify
62 test_linear_representation
63 test_make
64 test_make_empty
65 test_make_filled
66 test_make_from_c
67 test_make_from_string
68 test_max
69 test_min
70 test_mirror
71 test_mirrored
72 test_multiply
73 test_occurrences
74 test_out
75 test_plus
76 test_precede
77 test_prepend
78 test_prepend_boolean
79 test_prepend_character
80 test_prepend_double
81 test_prepend_integer
82 test_prepend_real
83 test_prepend_string
84 test_prunable
85 test_prune
86 test_prune_all
87 test_prune_all_leading
88 test_prune_all_trailing
89 test_put
90 test_remove
91 test_remove_head
92 test_remove_substring
93 test_remove_tail
94 test_replace_blank
95 test_replace_substring
96 test_replace_substring_all
97 test_resizable
98 test_resize
99 test_right_adjust
100 test_right_justify
101 test_same_string
102 test_same_characters
103 test_same_caseless_characters
104 test_same_type
105 test_set
106 test_share
107 test_shared_with
108 test_split
109 test_starts_with
110 test_string
111 test_subcopy
112 test_substring
113 test_substring_index
114 test_substring_index_in_bounds
115 test_tagged_out
116 test_three_way_comparison
117 test_to_c
118 test_to_cil
119 test_to_double
120 test_to_integer
121 test_to_integer_64
122 test_to_lower
123 test_to_real
124 test_to_upper
125 test_trim
126 test_twin
127 test_valid_index
128 test_wipe_out
129 end
130
131 feature {NONE} -- Implementation
132
133 test_adapt is
134 local
135 s, t: STRING_8
136 do
137 t := "1234567890"
138 s := t.adapt (t)
139 check_equality ("adapt", s, t)
140 check_equality ("adapt", s.area, t.area)
141 end
142
143 test_adapt_size is
144 local
145 s: STRING_8
146 do
147 create s.make (1000)
148 s.append ("12345")
149 s.adapt_size
150 check_equality ("adapt_size", s.count, 5)
151 end
152
153 test_additional_space is
154 local
155 s: STRING_8
156 i: INTEGER
157 do
158 create s.make (100)
159 i := s.additional_space
160 check_boolean ("additional_space", i >= 1)
161 end
162
163 test_append is
164 local
165 s: STRING_8
166 do
167 create s.make (10)
168 s.append ("12345")
169 check_equality ("append", s, "12345")
170
171 s.append (s)
172 check_equality ("append", s, "1234512345")
173
174 s.append ("")
175 check_equality ("append", s, "1234512345")
176 end
177
178 test_append_boolean is
179 local
180 s: STRING_8
181 do
182 create s.make (10)
183 s.append_boolean (True)
184 check_equality ("append_boolean", s, "True")
185
186 s.wipe_out
187 s.append_boolean (False)
188 check_equality ("append_boolean", s, "False")
189 end
190
191 test_append_character, test_extend is
192 local
193 s: STRING_8
194 do
195 create s.make (10)
196 s.append_character ('c')
197 check_equality ("append_character", s, "c")
198 end
199
200 test_append_double is
201 local
202 s: STRING_8
203 do
204 create s.make (10)
205 s.append_double (5.6)
206 check_equality ("append_double", s, "5.5999999999999996")
207 check_equality ("append_double", s.to_double, 5.6)
208 end
209
210 test_append_integer is
211 local
212 s: STRING_8
213 do
214 create s.make (10)
215 s.append_integer (123)
216 check_equality ("append_integer", s, "123")
217 check_equality ("append_integer", s.to_integer, 123)
218
219 s.wipe_out
220 s.append_integer (0x80000000)
221 check_equality ("append_integer", s, "-2147483648")
222 end
223
224 test_append_real is
225 local
226 s: STRING_8
227 r: REAL
228 do
229 r := {REAL_32} 5.6
230 create s.make (10)
231 s.append_real (r)
232 check_equality ("append_real", s, "5.6")
233 check_equality ("append_real", s.to_real, r)
234 end
235
236 test_append_string is
237 local
238 s: STRING_8
239 do
240 create s.make (10)
241 s.append_string ("12345")
242 check_equality ("append_string", s, "12345")
243
244 s.append_string (s)
245 check_equality ("append_string", s, "1234512345")
246
247 s.append_string ("")
248 check_equality ("append_string", s, "1234512345")
249
250 s.append_string (Void)
251 check_equality ("append_string", s, "1234512345")
252 end
253
254 test_as_lower is
255 local
256 s, t: STRING_8
257 do
258 create s.make_from_string ("ABcd EF gh I 123 ;")
259 t := s.as_lower
260 check_equality ("as_lower", t, "abcd ef gh i 123 ;")
261 check_boolean ("as_lower", t /= s)
262
263 s.to_lower
264 check_equality ("as_lower", t, s)
265 end
266
267 test_as_upper is
268 local
269 s, t: STRING_8
270 do
271 create s.make_from_string ("ABcd EF gh I 123 ;")
272 t := s.as_upper
273 check_equality ("as_upper", t, "ABCD EF GH I 123 ;")
274 check_boolean ("as_upper", t /= s)
275
276 s.to_upper
277 check_equality ("as_upper", t, s)
278 end
279
280 test_automatic_grow is
281 local
282 s: STRING_8
283 do
284 create s.make (10)
285 s.append ("123")
286 s.automatic_grow
287 check_equality ("automatic_grow", s, "123")
288 check_boolean ("automatic_grow", s.capacity >= 10)
289 end
290
291 test_center_justify is
292 local
293 s: STRING_8
294 do
295 create s.make (20)
296 s.append (" 1234567890 ")
297 s.center_justify
298 check_equality ("center_justify", s, " 1234567890 ")
299
300 s.wipe_out
301 s.append (" 1234567890 ")
302 s.center_justify
303 check_equality ("center_justify", s, " 1234567890 ")
304
305 s.wipe_out
306 s.append (" 1234567890 ")
307 s.append (" 1234567890 ")
308 s.center_justify
309 check_equality ("center_justify", s, " 1234567890 1234567890 ")
310
311 s.wipe_out
312 s.append ("123456")
313 s.center_justify
314 check_equality ("center_justify", s, "123456")
315 end
316
317 test_character_justify is
318 local
319 s: STRING_8
320 do
321 create s.make (10)
322 s.append ("1234567890x1234567890")
323 s.character_justify ('x', 3)
324 check_equality ("character_justify", s, "90x1234567890 ")
325
326 create s.make (10)
327 s.append ("1234567890x1234567890")
328 s.character_justify ('x', 20)
329 check_equality ("character_justify", s, " 1234567890x1234567890")
330
331 s := "1234567890x1234567890"
332 s.character_justify ('s', 1)
333 check_equality ("character_justify", s, "1234567890x1234567890")
334 end
335
336 test_copy is
337 local
338 s, t: STRING_8
339 do
340 create s.make (10)
341 s.append ("12345")
342 s.copy (s)
343 check_equality ("copy", s, "12345")
344
345 s.copy ("1234567890")
346 check_equality ("copy", s, "1234567890")
347
348 create s.make (0)
349 t := "12345"
350 s.copy (t)
351 check_equality ("copy", s, t)
352 check_boolean ("copy", not s.shared_with (t))
353 end
354
355 test_ends_with is
356 local
357 s: STRING_8
358 do
359 s := "1234567890"
360 check_boolean ("Ends with empty%N", s.ends_with (""))
361 check_boolean ("Ends with itself%N", s.ends_with (s))
362 check_boolean ("Ends with its twin%N", s.ends_with (s.twin))
363 check_boolean ("Not ends with itself twice%N", not s.ends_with (s + s))
364 check_boolean ("Not ends with 123%N", not s.ends_with ("123"))
365 check_boolean ("Not ends with 23%N", not s.ends_with ("23"))
366 check_boolean ("Ends with 890%N", s.ends_with ("890"))
367 check_boolean ("Not ends with 89%N", not s.ends_with ("89"))
368 end
369
370 test_fill_blank is
371 local
372 s: STRING_8
373 do
374 create s.make (10)
375 s.fill_blank
376 check_equality ("fill_blank", s, " ")
377
378 s.wipe_out
379 s.append ("12345")
380 s.fill_blank
381 check_equality ("fill_blank", s, " ")
382 end
383
384 test_fill_character is
385 local
386 s: STRING_8
387 do
388 create s.make (10)
389 s.fill_character ('1')
390 check_equality ("fill_character", s, "1111111111")
391
392 s.wipe_out
393 s.append ("12345")
394 s.fill_character ('1')
395 check_equality ("fill_character", s, "1111111111")
396 end
397
398 test_fill_with is
399 local
400 s: STRING_8
401 do
402 create s.make (10)
403 s.fill_with ('1')
404 check_equality ("fill_with", s, "")
405
406 s.wipe_out
407 s.append ("12345")
408 s.fill_with ('1')
409 check_equality ("fill_with", s, "11111")
410 end
411
412 test_from_c is
413 local
414 l_ptr: MANAGED_POINTER
415 s: STRING_8
416 do
417 s := "abcdef"
418 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 48, 49, 50, 51, 52, 53, 54, 0 >>)
419 s.from_c (l_ptr.item)
420 check_boolean ("from_c", s.is_equal ("0123456"))
421
422 s := "abcdef"
423 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 0, 48, 49, 50, 51, 52, 53, 54, 0 >>)
424 s.from_c (l_ptr.item)
425 check_boolean ("from_c", s.is_empty)
426 end
427
428 test_from_c_substring is
429 local
430 l_ptr: MANAGED_POINTER
431 s: STRING_8
432 do
433 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} <<65,66,67,68>>)
434 create s.make (2)
435
436 s.from_c_substring (l_ptr.item, 3, 3)
437 check_boolean ("from_c_substring", s.is_equal ("C"))
438
439 s.from_c_substring (l_ptr.item, 2, 3)
440 check_boolean ("from_c_substring", s.is_equal ("BC"))
441
442 s.from_c_substring (l_ptr.item, 1, 3)
443 check_boolean ("from_c_substring", s.is_equal ("ABC"))
444
445 s.from_c_substring (l_ptr.item, 1, 4)
446 check_boolean ("from_c_substring", s.is_equal ("ABCD"))
447 end
448
449 test_fuzzy_index is
450 local
451 s: STRING_8
452 i: INTEGER
453 do
454 s := "Eiffel Software Enterprise Edition"
455 i := s.fuzzy_index ("Soltware", 1, 1)
456 check_equality ("fuzzy_index", i, 8)
457
458 i := s.fuzzy_index ("Sotware", 1, 1)
459 check_equality ("fuzzy_index", i, 0)
460
461 i := s.fuzzy_index ("Edataon", 10, 2)
462 check_equality ("fuzzy_index", i, 28)
463
464 i := s.fuzzy_index ("Edataon", 29, 2)
465 check_equality ("fuzzy_index", i, 0)
466
467 i := s.fuzzy_index ("Enterprise", 1, 0)
468 check_equality ("fuzzy_index", i, 17)
469
470 i := s.fuzzy_index ("Entreprise", 1, 0)
471 check_equality ("fuzzy_index", i, 0)
472
473 i := s.fuzzy_index ("Enterprise", 1, 0)
474 check_equality ("fuzzy_index", i, 17)
475 end
476
477 test_grow is
478 local
479 s: STRING_8
480 do
481 s := ""
482 s.grow (0)
483 check_equality ("grow", s, "")
484 s.grow (5)
485 check_equality ("grow", s, "")
486 s := "12345"
487 s.grow (0)
488 check_equality ("grow", s, "12345")
489 s.grow (5)
490 check_equality ("grow", s, "12345")
491 s.grow (10)
492 check_equality ("grow", s, "12345")
493 end
494
495 test_has is
496 local
497 s: STRING_8
498 do
499 create s.make (10)
500 check_boolean ("has", not s.has ('c'))
501 check_boolean ("has", not s.has ('%U'))
502
503 s.append ("1234c1234")
504 check_boolean ("has", s.has ('c'))
505 check_boolean ("has", not s.has ('9'))
506
507 s.wipe_out
508 check_boolean ("has", not s.has ('c'))
509 check_boolean ("has", not s.has ('9'))
510 end
511
512 test_has_substring is
513 local
514 s: STRING_8
515 do
516 create s.make (10)
517 s.append ("!23")
518 check_boolean ("has_substring", s.has_substring (s))
519 check_boolean ("has_substring", s.has_substring ("23"))
520 check_boolean ("has_substring", not s.has_substring ("12"))
521 check_boolean ("has_substring", not s.has_substring ("!23 "))
522 check_boolean ("has_substring", s.has_substring ("!23"))
523
524 check_boolean ("has_substring", ("").has_substring (""))
525 check_boolean ("has_substring", ("foobar").has_substring ("oo"))
526 check_boolean ("has_substring", not ("foobar").has_substring ("abo"))
527 end
528
529 test_hash_code is
530 -- We do not enforce consistent hashcode values, so we only check
531 -- that it is updated properly. See bug#19258.
532 local
533 s: STRING_8
534 h1, h2: INTEGER
535 do
536 s := "1234c"
537 h1 := s.hash_code
538 h2 := s.case_insensitive_hash_code
539
540 s.append_string ("1234")
541 check_boolean ("hash_code", s.hash_code /= h1)
542 check_boolean ("case_insensitive_hash_code", s.case_insensitive_hash_code /= h2)
543 end
544
545 test_index_of is
546 local
547 s: STRING_8
548 i: INTEGER
549 do
550 create s.make (10)
551 s.append ("1234567890")
552 i := s.index_of ('0', 1)
553 check_equality ("index_of", i, 10)
554
555 i := s.index_of ('x', 1)
556 check_equality ("index_of", i , 0)
557
558 i := s.index_of ('5', 4)
559 check_equality ("index_of", i , 5)
560
561 i := s.index_of ('5', 5)
562 check_equality ("index_of", i , 5)
563
564 i := s.index_of ('5', 6)
565 check_equality ("index_of", i , 0)
566 end
567
568 test_insert_character is
569 local
570 s: STRING_8
571 do
572 create s.make (10)
573 s.append ("12345")
574 s.insert_character ('c', 1)
575 check_equality ("insert_character", s, "c12345")
576
577 s.wipe_out
578 s.append ("12345")
579 s.insert_character ('c', 2)
580 check_equality ("insert_character", s, "1c2345")
581
582 s.wipe_out
583 s.append ("12345")
584 s.insert_character ('c', 3)
585 check_equality ("insert_character", s, "12c345")
586
587 s.wipe_out
588 s.append ("12345")
589 s.insert_character ('c', 4)
590 check_equality ("insert_character", s, "123c45")
591
592 s.wipe_out
593 s.append ("12345")
594 s.insert_character ('c', 5)
595 check_equality ("insert_character", s, "1234c5")
596
597 s.wipe_out
598 s.append ("12345")
599 s.insert_character ('c', 6)
600 check_equality ("insert_character", s, "12345c")
601 end
602
603 test_insert_string is
604 local
605 s, t: STRING_8
606 do
607 create s.make (10)
608 s.append ("12345")
609 s.insert_string (s, 1)
610 check_equality ("insert_string", s, "1234512345")
611
612 s.wipe_out
613 s.append ("12345")
614 s.insert_string (s, 2)
615 check_equality ("insert_string", s, "1123452345")
616
617 s.wipe_out
618 s.append ("12345")
619 s.insert_string (s, 3)
620 check_equality ("insert_string", s, "1212345345")
621
622 s.wipe_out
623 s.append ("12345")
624 s.insert_string (s, 4)
625 check_equality ("insert_string", s, "1231234545")
626
627 s.wipe_out
628 s.append ("12345")
629 s.insert_string (s, 5)
630 check_equality ("insert_string", s, "1234123455")
631
632 s.wipe_out
633 s.append ("12345")
634 s.insert_string (s, 6)
635 check_equality ("insert_string", s, "1234512345")
636
637 create s.make (10)
638 t := "12345"
639 s.append ("12345")
640 s.insert_string (t, 1)
641 check_equality ("insert_string", s, "1234512345")
642
643 s.wipe_out
644 s.append ("12345")
645 s.insert_string (t, 2)
646 check_equality ("insert_string", s, "1123452345")
647
648 s.wipe_out
649 s.append ("12345")
650 s.insert_string (t, 3)
651 check_equality ("insert_string", s, "1212345345")
652
653 s.wipe_out
654 s.append ("12345")
655 s.insert_string (t, 4)
656 check_equality ("insert_string", s, "1231234545")
657
658 s.wipe_out
659 s.append ("12345")
660 s.insert_string (t, 5)
661 check_equality ("insert_string", s, "1234123455")
662
663 s.wipe_out
664 s.append ("12345")
665 s.insert_string (t, 6)
666 check_equality ("insert_string", s, "1234512345")
667
668 s := "bar"
669 s.insert_string (s, 2)
670 check_equality ("insert_string", s, "bbarar")
671
672 s := "abcdef"
673 s.insert_string (s, 3)
674 check_equality ("insert_string", s, "ababcdefcdef")
675
676 s := "bar"
677 s.insert_string ("bar", 2)
678 check_equality ("insert_string", s, "bbarar")
679 end
680
681 test_is_boolean is
682 local
683 s: STRING_8
684 do
685 s := "true"
686 check_boolean ("is_boolean", s.is_boolean)
687
688 s := " true "
689 check_boolean ("is_boolean", not s.is_boolean)
690
691 s := "True"
692 check_boolean ("is_boolean", s.is_boolean)
693
694 s := "false"
695 check_boolean ("is_boolean", s.is_boolean)
696
697 s := " false "
698 check_boolean ("is_boolean", not s.is_boolean)
699
700 s := "false"
701 check_boolean ("is_boolean", s.is_boolean)
702
703 s := "TRUE"
704 check_boolean ("is_boolean", s.is_boolean)
705
706 s := "FALSE"
707 check_boolean ("is_boolean", s.is_boolean)
708
709 s := "Tru"
710 check_boolean ("is_boolean", not s.is_boolean)
711
712 s := "tru"
713 check_boolean ("is_boolean", not s.is_boolean)
714
715 s := "Fal"
716 check_boolean ("is_boolean", not s.is_boolean)
717
718 s := "fal"
719 check_boolean ("is_boolean", not s.is_boolean)
720 end
721
722 test_is_case_insensitive_equal is
723 local
724 s: STRING_8
725 do
726 create s.make (10)
727 s.append ("12345")
728 check_boolean ("is_case_insensitive_equal", s.is_case_insensitive_equal (s))
729 check_boolean ("is_case_insensitive_equal", s.is_case_insensitive_equal ("12345"))
730 check_boolean ("is_case_insensitive_equal", not s.is_case_insensitive_equal ("123456"))
731 check_boolean ("is_case_insensitive_equal", not s.is_case_insensitive_equal ("1234"))
732
733 s := "abcdef"
734 check_boolean ("is_case_insensitive_equal", s.is_case_insensitive_equal ("ABCDEF"))
735
736 s := "ABCDEF"
737 check_boolean ("is_case_insensitive_equal", s.is_case_insensitive_equal ("abcdef"))
738
739 s := "ABCdef"
740 check_boolean ("is_case_insensitive_equal", s.is_case_insensitive_equal ("abcDEF"))
741
742 check_boolean ("is_case_insensitive_equal", not s.is_case_insensitive_equal (""))
743 end
744
745 test_is_double is
746 do
747 check_boolean ("is_double", ("5").is_double)
748 check_boolean ("is_double", ("5.5").is_double)
749 check_boolean ("is_double", ("5E4").is_double)
750 check_boolean ("is_double", not ("5 E4").is_double)
751 check_boolean ("is_double", ("5e-4").is_double)
752 check_boolean ("is_double", ("5e5").is_double)
753 check_boolean ("is_double", not ("5e 5").is_double)
754 check_boolean ("is_double", (".0").is_double)
755 check_boolean ("is_double", ("0.1e10").is_double)
756 check_boolean ("is_double", ("-1").is_double)
757 check_boolean ("is_double", ("-1.0").is_double)
758 check_boolean ("is_double", ("-1e1").is_double)
759 check_boolean ("is_double", ("-1e-1").is_double)
760 check_boolean ("is_double", ("-1.0e1").is_double)
761 check_boolean ("is_double", ("-1.0e-1").is_double)
762 check_boolean ("is_double", ("-.1").is_double)
763 check_boolean ("is_double", ("1e5").is_double)
764 check_boolean ("is_double", not ("e5").is_double)
765 check_boolean ("is_double", not (".e1").is_double)
766 check_boolean ("is_double", ("1e").is_double)
767 check_boolean ("is_double", ("1e1").is_double)
768 check_boolean ("is_double", (" 5").is_double)
769 check_boolean ("is_double", ("5 ").is_double)
770 check_boolean ("is_double", not ("%U5").is_double)
771 check_boolean ("is_double", not ("5.6%U").is_double)
772 check_boolean ("is_double", ("1").is_double)
773 end
774
775 test_is_empty is
776 local
777 s: STRING_8
778 do
779 create s.make (10)
780 s.append ("Fds")
781 check_boolean ("is_empty", not s.is_empty)
782
783 s.wipe_out
784 check_boolean ("is_empty", s.is_empty)
785
786 check_boolean ("is_empty", ("").is_empty)
787 end
788
789 test_is_equal is
790 local
791 s: STRING_8
792 do
793 create s.make (10)
794 s.append ("12345")
795 check_boolean ("is_equal", s.is_equal (s))
796 check_boolean ("is_equal", s.is_equal ("12345"))
797 check_boolean ("is_equal", not s.is_equal ("123456"))
798 check_boolean ("is_equal", not s.is_equal ("1234"))
799
800 s := "abcdef"
801 check_boolean ("is_equal", not s.is_equal ("ABCDEF"))
802
803 check_boolean ("is_equal", not s.is_equal (""))
804 end
805
806 test_is_inserted is
807 local
808 s: STRING_8
809 do
810 s := "1234"
811 s.extend ('c')
812 check_boolean ("is_inserted", s.is_inserted ('c'))
813 end
814
815 test_is_integer is
816 do
817 check_boolean ("is_integer", not ("a").is_integer)
818 check_boolean ("is_integer", not ("%U1").is_integer)
819 check_boolean ("is_integer", ("1").is_integer)
820 check_boolean ("is_integer", (" 1").is_integer)
821 check_boolean ("is_integer", ("1 ").is_integer)
822 end
823
824 test_is_real is
825 do
826 check_boolean ("is_real", ("5").is_real)
827 check_boolean ("is_real", ("5.5").is_real)
828 check_boolean ("is_real", ("5E4").is_real)
829 check_boolean ("is_real", not ("5 E4").is_real)
830 check_boolean ("is_real", ("5e-4").is_real)
831 check_boolean ("is_real", ("5e5").is_real)
832 check_boolean ("is_real", not ("5e 5").is_real)
833 check_boolean ("is_real", (".0").is_real)
834 check_boolean ("is_real", ("0.1e10").is_real)
835 check_boolean ("is_real", ("-1").is_real)
836 check_boolean ("is_real", ("-1.0").is_real)
837 check_boolean ("is_real", ("-1e1").is_real)
838 check_boolean ("is_real", ("-1e-1").is_real)
839 check_boolean ("is_real", ("-1.0e1").is_real)
840 check_boolean ("is_real", ("-1.0e-1").is_real)
841 check_boolean ("is_real", ("-.1").is_real)
842 check_boolean ("is_real", ("1e5").is_real)
843 check_boolean ("is_real", not ("e5").is_real)
844 check_boolean ("is_real", not (".e1").is_real)
845 check_boolean ("is_real", ("1e").is_real)
846 check_boolean ("is_real", ("1e1").is_real)
847 check_boolean ("is_real", (" 5").is_real)
848 check_boolean ("is_real", ("5 ").is_real)
849 check_boolean ("is_real", not ("%U5").is_real)
850 check_boolean ("is_real", not ("5.6%U").is_real)
851 end
852
853 test_infix_greater is
854 local
855 s: STRING_8
856 p: STRING_8
857 do
858 s := "12345"
859 p := "12345"
860 check_boolean (">", not (s > s))
861 check_boolean (">", not (s > p))
862 p.append_character ('a')
863 check_boolean (">", not (s > p))
864 check_boolean (">", p > s)
865 p := "12045"
866 check_boolean (">", s > p)
867 check_boolean (">", not (p > s))
868 s := "123"
869 check_boolean (">", s > p)
870 check_boolean (">", not (p > s))
871
872 s := ""
873 p := ""
874 check_boolean (">", not (s > s))
875 check_boolean (">", not (s > p))
876 p.append_character ('a')
877 check_boolean (">", not (s > p))
878 check_boolean (">", p > s)
879 end
880
881 test_infix_greater_or_equal is
882 local
883 s: STRING_8
884 p: STRING_8
885 do
886 s := "12345"
887 p := "12345"
888 check_boolean (">=", s >= s)
889 check_boolean (">=", s >= p)
890 p.append_character ('a')
891 check_boolean (">=", not (s >= p))
892 check_boolean (">=", p >= s)
893 p := "12045"
894 check_boolean (">=", s >= p)
895 check_boolean (">=", not (p >= s))
896 s := "123"
897 check_boolean (">=", s >= p)
898 check_boolean (">=", not (p >= s))
899
900 s := ""
901 p := ""
902 check_boolean (">=", s >= s)
903 check_boolean (">=", s >= p)
904 p.append_character ('a')
905 check_boolean (">=", not (s >= p))
906 check_boolean (">=", p >= s)
907 end
908
909 test_infix_less is
910 local
911 s: STRING_8
912 p: STRING_8
913 do
914 s := "12345"
915 p := "12345"
916 check_boolean ("<", not (s < s))
917 check_boolean ("<", not (s < p))
918 p.append_character ('a')
919 check_boolean ("<", s < p)
920 check_boolean ("<", not (p < s))
921 p := "12045"
922 check_boolean ("<", not (s < p))
923 check_boolean ("<", p < s)
924 s := "123"
925 check_boolean ("<", not (s < p))
926 check_boolean ("<", p < s)
927
928 s := ""
929 p := ""
930 check_boolean ("<", not (s < s))
931 check_boolean ("<", not (s < p))
932 p.append_character ('a')
933 check_boolean ("<", s < p)
934 check_boolean ("<", not (p < s))
935 end
936
937 test_infix_less_or_equal is
938 local
939 s: STRING_8
940 p: STRING_8
941 do
942 s := "12345"
943 p := "12345"
944 check_boolean ("<=", s <= s)
945 check_boolean ("<=", s <= p)
946 p.append_character ('a')
947 check_boolean ("<=", s <= p)
948 check_boolean ("<=", not (p <= s))
949 p := "12045"
950 check_boolean ("<=", not (s <= p))
951 check_boolean ("<=", p <= s)
952 s := "123"
953 check_boolean ("<=", not (s <= p))
954 check_boolean ("<=", p <= s)
955
956 s := ""
957 p := ""
958 check_boolean ("<=", s <= s)
959 check_boolean ("<=", s <= p)
960 p.append_character ('a')
961 check_boolean ("<=", s <= p)
962 check_boolean ("<=", not (p <= s))
963 end
964
965 test_infix_plus is
966 local
967 s: STRING_8
968 do
969 s := "12345"
970 check_equality ("+", s + s, "1234512345")
971 check_equality ("+", "" + "", "")
972 check_equality ("+", "" + s, "12345")
973 check_equality ("+", s + "", "12345")
974 end
975
976 test_keep_head is
977 local
978 s: STRING_8
979 do
980 s := ""
981 s.keep_head (0)
982 check_equality ("keep_head", s, "")
983
984 s := ""
985 s.keep_head (1)
986 check_equality ("keep_head", s, "")
987
988 s := "12345"
989 s.keep_head (0)
990 check_equality ("keep_head", s, "")
991
992 s := "12345"
993 s.keep_head (1)
994 check_equality ("keep_head", s, "1")
995
996 s := "12345"
997 s.keep_head (2)
998 check_equality ("keep_head", s, "12")
999
1000 s := "12345"
1001 s.keep_head (3)
1002 check_equality ("keep_head", s, "123")
1003
1004 s := "12345"
1005 s.keep_head (4)
1006 check_equality ("keep_head", s, "1234")
1007
1008 s := "12345"
1009 s.keep_head (5)
1010 check_equality ("keep_head", s, "12345")
1011
1012 s := "12345"
1013 s.keep_head (6)
1014 check_equality ("keep_head", s, "12345")
1015
1016 s := "12345"
1017 s.keep_head (100)
1018 check_equality ("keep_head", s, "12345")
1019 end
1020
1021 test_keep_tail is
1022 local
1023 s: STRING_8
1024 do
1025 s := ""
1026 s.keep_tail (0)
1027 check_equality ("keep_tail", s, "")
1028
1029 s := ""
1030 s.keep_tail (1)
1031 check_equality ("keep_tail", s, "")
1032
1033 s := "12345"
1034 s.keep_tail (0)
1035 check_equality ("keep_tail", s, "")
1036
1037 s := "12345"
1038 s.keep_tail (1)
1039 check_equality ("keep_tail", s, "5")
1040
1041 s := "12345"
1042 s.keep_tail (2)
1043 check_equality ("keep_tail", s, "45")
1044
1045 s := "12345"
1046 s.keep_tail (3)
1047 check_equality ("keep_tail", s, "345")
1048
1049 s := "12345"
1050 s.keep_tail (4)
1051 check_equality ("keep_tail", s, "2345")
1052
1053 s := "12345"
1054 s.keep_tail (5)
1055 check_equality ("keep_tail", s, "12345")
1056
1057 s := "12345"
1058 s.keep_tail (6)
1059 check_equality ("keep_tail", s, "12345")
1060
1061 s := "12345"
1062 s.keep_tail (100)
1063 check_equality ("keep_tail", s, "12345")
1064 end
1065
1066 test_last_index_of is
1067 local
1068 s: STRING_8
1069 do
1070 s := "a"
1071 check_equality ("last_boolean", s.last_index_of ('a', 1), 1)
1072 check_equality ("last_boolean", s.last_index_of ('b', 1), 0)
1073
1074 s := "1234554321"
1075 check_equality ("last_boolean", s.last_index_of ('3', 10), 8)
1076 check_equality ("last_boolean", s.last_index_of ('3', 5), 3)
1077 check_equality ("last_boolean", s.last_index_of ('3', 3), 3)
1078 check_equality ("last_boolean", s.last_index_of ('3', 2), 0)
1079 check_equality ("last_boolean", s.last_index_of ('X', 10), 0)
1080 end
1081
1082 test_left_adjust is
1083 local
1084 s: STRING_8
1085 do
1086 s := "12345"
1087 s.left_adjust
1088 check_equality ("left_adjust", s, "12345")
1089
1090 s := " %T%T12345"
1091 s.left_adjust
1092 check_equality ("left_adjust", s, "12345")
1093
1094 s := "%N %T12345"
1095 s.left_adjust
1096 check_equality ("left_adjust", s, "12345")
1097
1098 s := "a 12345"
1099 s.left_adjust
1100 check_equality ("left_adjust", s, "a 12345")
1101 end
1102
1103 test_left_justify is
1104 local
1105 s: STRING_8
1106 do
1107 s := "12345"
1108 s.left_justify
1109 check_equality ("left_justify", s, "12345")
1110
1111 s := "12345 "
1112 s.left_justify
1113 check_equality ("left_justify", s, "12345 ")
1114
1115 s := " 12345 "
1116 s.left_justify
1117 check_equality ("left_justify", s, "12345 ")
1118
1119 s := " 12345"
1120 s.left_justify
1121 check_equality ("left_justify", s, "12345 ")
1122
1123 s := ""
1124 s.left_justify
1125 check_equality ("left_justify", s, "")
1126 end
1127
1128 test_linear_representation is
1129 local
1130 s: STRING_8
1131 l_c: LINEAR [CHARACTER_8]
1132 i: INTEGER
1133 do
1134 s := "12345"
1135 l_c := s.linear_representation
1136 check_boolean ("linear_representation", l_c /= s.linear_representation)
1137 check_boolean ("linear_representation", not s.linear_representation.is_empty)
1138 from
1139 l_c.start
1140 until
1141 l_c.off
1142 loop
1143 i := i + 1
1144 check_boolean ("linear_representation", l_c.item = s.item (i))
1145 l_c.forth
1146 end
1147 check_boolean ("linear_representation", i = 5)
1148 end
1149
1150 test_make is
1151 local
1152 s: STRING_8
1153 p: SPECIAL [CHARACTER_8]
1154 do
1155 s := "1234567890"
1156 p := s.area
1157 s.make (2)
1158 check_boolean ("make", s.is_empty)
1159 check_boolean ("make", s.count = 0)
1160 check_boolean ("make", s.capacity >= 2)
1161 check_boolean ("make", s.area /= p)
1162
1163 create s.make (2)
1164 check_boolean ("make", s.is_empty)
1165 check_boolean ("make", s.count = 0)
1166 check_boolean ("make", s.capacity >= 2)
1167 -- Extra check that there are no aliasing within a STRING_8 creation
1168 check_boolean ("make", s.area /= p)
1169 end
1170
1171 test_make_empty is
1172 local
1173 s: STRING_8
1174 p: SPECIAL [CHARACTER_8]
1175 do
1176 s := "1234567890"
1177 p := s.area
1178 s.make_empty
1179 check_boolean ("make_empty", s.is_empty)
1180 check_boolean ("make_empty", s.count = 0)
1181 check_boolean ("make_empty", s.capacity >= 0)
1182 check_boolean ("make_empty", s.area /= p)
1183
1184 create s.make_empty
1185 check_boolean ("make_empty", s.is_empty)
1186 check_boolean ("make_empty", s.count = 0)
1187 check_boolean ("make_empty", s.capacity >= 0)
1188 -- Extra check that there are no aliasing within a STRING_8 creation
1189 check_boolean ("make_empty", s.area /= p)
1190 end
1191
1192 test_make_filled is
1193 local
1194 s: STRING_8
1195 do
1196 create s.make_filled (' ', 10)
1197 check_boolean ("make_filled", s.count = 10)
1198 check_boolean ("make_filled", s.capacity >= 10)
1199 check_boolean ("make_filled", s.occurrences (' ') = 10)
1200 check_boolean ("make_filled", s.occurrences ('x') = 0)
1201 check_boolean ("make_filled", s.is_equal (" "))
1202
1203 create s.make_filled ('a', 10)
1204 check_boolean ("make_filled", s.count = 10)
1205 check_boolean ("make_filled", s.capacity >= 10)
1206 check_boolean ("make_filled", s.occurrences (' ') = 0)
1207 check_boolean ("make_filled", s.occurrences ('x') = 0)
1208 check_boolean ("make_filled", s.occurrences ('a') = 10)
1209 check_boolean ("make_filled", s.is_equal ("aaaaaaaaaa"))
1210 end
1211
1212 test_make_from_c is
1213 local
1214 l_ptr: MANAGED_POINTER
1215 s: STRING_8
1216 do
1217 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 48, 49, 50, 51, 52, 53, 54, 0 >>)
1218 create s.make_from_c (l_ptr.item)
1219 check_boolean ("make_from_c", s.is_equal ("0123456"))
1220
1221 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 0, 48, 49, 50, 51, 52, 53, 54, 0 >>)
1222 create s.make_from_c (l_ptr.item)
1223 check_boolean ("make_from_c", s.is_empty)
1224
1225 s := "abcdef"
1226 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 48, 49, 50, 51, 52, 53, 54, 0 >>)
1227 s.make_from_c (l_ptr.item)
1228 check_boolean ("make_from_c", s.is_equal ("0123456"))
1229
1230 s := "abcdef"
1231 create l_ptr.make_from_array ({ARRAY [NATURAL_8]} << 0, 48, 49, 50, 51, 52, 53, 54, 0 >>)
1232 s.make_from_c (l_ptr.item)
1233 check_boolean ("make_from_c", s.is_empty)
1234 end
1235
1236 test_make_from_string is
1237 local
1238 s, p: STRING_8
1239 do
1240 p := "12345"
1241 s := p
1242 s.make_from_string (p)
1243 check_boolean ("make_from_string", s.area = p.area)
1244 check_boolean ("make_from_string", s.count = p.count)
1245
1246 create s.make_from_string (p)
1247 check_boolean ("make_from_string", s.is_equal ("12345"))
1248 check_boolean ("make_from_string", s.area /= p.area)
1249 end
1250
1251 test_max is
1252 local
1253 s: STRING_8
1254 p: STRING_8
1255 do
1256 s := "12345"
1257 p := "12345"
1258 check_boolean ("max", s.max (s) = s)
1259 check_boolean ("max", s.max (p) = s)
1260 check_boolean ("max", p.max (s) = p)
1261 p.append_character ('a')
1262 check_boolean ("max", s.max (p) = p)
1263 check_boolean ("max", p.max (s) = p)
1264 p := "12045"
1265 check_boolean ("max", s.max (p) = s)
1266 check_boolean ("max", p.max (s) = s)
1267
1268 s := ""
1269 p := ""
1270 check_boolean ("max", s.max (s) = s)
1271 check_boolean ("max", s.max (p) = s)
1272 check_boolean ("max", p.max (s) = p)
1273 p.append_character ('a')
1274 check_boolean ("max", s.max (p) = p)
1275 check_boolean ("max", p.max (s) = p)
1276 end
1277
1278 test_min is
1279 local
1280 s: STRING_8
1281 p: STRING_8
1282 do
1283 s := "12345"
1284 p := "12345"
1285 check_boolean ("min", s.min (s) = s)
1286 check_boolean ("min", s.min (p) = s)
1287 check_boolean ("min", p.min (s) = p)
1288 p.append_character ('a')
1289 check_boolean ("min", s.min (p) = s)
1290 check_boolean ("min", p.min (s) = s)
1291 p := "12045"
1292 check_boolean ("min", s.min (p) = p)
1293 check_boolean ("min", p.min (s) = p)
1294
1295 s := ""
1296 p := ""
1297 check_boolean ("min", s.min (s) = s)
1298 check_boolean ("min", s.min (p) = s)
1299 check_boolean ("min", p.min (s) = p)
1300 p.append_character ('a')
1301 check_boolean ("min", s.min (p) = s)
1302 check_boolean ("min", p.min (s) = s)
1303 end
1304
1305 test_mirror is
1306 local
1307 s: STRING_8
1308 do
1309 s := ""
1310 s.mirror
1311 check_equality ("mirror", s, "")
1312 s := "a"
1313 s.mirror
1314 check_equality ("mirror", s, "a")
1315 s := "ab"
1316 s.mirror
1317 check_equality ("mirror", s, "ba")
1318 s := "abc"
1319 s.mirror
1320 check_equality ("mirror", s, "cba")
1321 s := "abcd"
1322 s.mirror
1323 check_equality ("mirror", s, "dcba")
1324 s := "abcde"
1325 s.mirror
1326 check_equality ("mirror", s, "edcba")
1327 end
1328
1329 test_mirrored is
1330 local
1331 s: STRING_8
1332 p: STRING_8
1333 do
1334 s := ""
1335 p := s.mirrored
1336 check_equality ("mirrored", s, "")
1337 check_equality ("mirrored", p, "")
1338 s := "a"
1339 p := s.mirrored
1340 check_equality ("mirrored", s, "a")
1341 check_equality ("mirrored", p, "a")
1342 s := "ab"
1343 p := s.mirrored
1344 check_equality ("mirrored", s, "ab")
1345 check_equality ("mirrored", p, "ba")
1346 s := "abc"
1347 p := s.mirrored
1348 check_equality ("mirrored", s, "abc")
1349 check_equality ("mirrored", p, "cba")
1350 s := "abcd"
1351 p := s.mirrored
1352 check_equality ("mirrored", s, "abcd")
1353 check_equality ("mirrored", p, "dcba")
1354 s := "abcde"
1355 p := s.mirrored
1356 check_equality ("mirrored", s, "abcde")
1357 check_equality ("mirrored", p, "edcba")
1358 end
1359
1360 test_multiply is
1361 local
1362 s: STRING_8
1363 do
1364 s := ""
1365 s.multiply (1)
1366 check_equality ("multiply", s, "")
1367 s.multiply (2)
1368 check_equality ("multiply", s, "")
1369 s.multiply (3)
1370 check_equality ("multiply", s, "")
1371
1372 s := "a"
1373 s.multiply (1)
1374 check_equality ("multiply", s, "a")
1375 s := "a"
1376 s.multiply (2)
1377 check_equality ("multiply", s, "aa")
1378 s := "a"
1379 s.multiply (3)
1380 check_equality ("multiply", s, "aaa")
1381
1382 s := "ab"
1383 s.multiply (1)
1384 check_equality ("multiply", s, "ab")
1385 s := "ab"
1386 s.multiply (2)
1387 check_equality ("multiply", s, "abab")
1388 s := "ab"
1389 s.multiply (3)
1390 check_equality ("multiply", s, "ababab")
1391
1392 s := "abc"
1393 s.multiply (1)
1394 check_equality ("multiply", s, "abc")
1395 s := "abc"
1396 s.multiply (2)
1397 check_equality ("multiply", s, "abcabc")
1398 s := "abc"
1399 s.multiply (3)
1400 check_equality ("multiply", s, "abcabcabc")
1401 end
1402
1403 test_occurrences is
1404 do
1405 check_boolean ("occurrences", ("").occurrences ('%U') = 0)
1406 check_boolean ("occurrences", ("").occurrences (' ') = 0)
1407 check_boolean ("occurrences", ("").occurrences ('a') = 0)
1408 check_boolean ("occurrences", ("%U").occurrences ('%U') = 1)
1409 check_boolean ("occurrences", ("%U").occurrences (' ') = 0)
1410 check_boolean ("occurrences", ("%U").occurrences ('a') = 0)
1411 check_boolean ("occurrences", (" ").occurrences ('%U') = 0)
1412 check_boolean ("occurrences", (" ").occurrences (' ') = 1)
1413 check_boolean ("occurrences", (" ").occurrences ('a') = 0)
1414 check_boolean ("occurrences", ("a").occurrences ('%U') = 0)
1415 check_boolean ("occurrences", ("a").occurrences (' ') = 0)
1416 check_boolean ("occurrences", ("a").occurrences ('a') = 1)
1417 check_boolean ("occurrences", ("%U%U").occurrences ('%U') = 2)
1418 check_boolean ("occurrences", ("%U%U").occurrences (' ') = 0)
1419 check_boolean ("occurrences", ("%U%U").occurrences ('a') = 0)
1420 check_boolean ("occurrences", ("%U ").occurrences ('%U') = 1)
1421 check_boolean ("occurrences", ("%U ").occurrences (' ') = 1)
1422 check_boolean ("occurrences", ("%U ").occurrences ('a') = 0)
1423 check_boolean ("occurrences", (" %U").occurrences ('%U') = 1)
1424 check_boolean ("occurrences", (" %U").occurrences (' ') = 1)
1425 check_boolean ("occurrences", (" %U").occurrences ('a') = 0)
1426 check_boolean ("occurrences", (" ").occurrences ('%U') = 0)
1427 check_boolean ("occurrences", (" ").occurrences (' ') = 2)
1428 check_boolean ("occurrences", (" ").occurrences ('a') = 0)
1429 check_boolean ("occurrences", (" a").occurrences ('%U') = 0)
1430 check_boolean ("occurrences", (" a").occurrences (' ') = 1)
1431 check_boolean ("occurrences", (" a").occurrences ('a') = 1)
1432 check_boolean ("occurrences", ("a ").occurrences ('%U') = 0)
1433 check_boolean ("occurrences", ("a ").occurrences (' ') = 1)
1434 check_boolean ("occurrences", ("a ").occurrences ('a') = 1)
1435 check_boolean ("occurrences", ("aa").occurrences ('%U') = 0)
1436 check_boolean ("occurrences", ("aa").occurrences (' ') = 0)
1437 check_boolean ("occurrences", ("aa").occurrences ('a') = 2)
1438 check_boolean ("occurrences", ("%U%U%U").occurrences ('%U') = 3)
1439 check_boolean ("occurrences", ("%U%U%U").occurrences (' ') = 0)
1440 check_boolean ("occurrences", ("%U%U%U").occurrences ('a') = 0)
1441 check_boolean ("occurrences", (" %U%U").occurrences ('%U') = 2)
1442 check_boolean ("occurrences", (" %U%U").occurrences (' ') = 1)
1443 check_boolean ("occurrences", (" %U%U").occurrences ('a') = 0)
1444 check_boolean ("occurrences", ("%U %U").occurrences ('%U') = 2)
1445 check_boolean ("occurrences", ("%U %U").occurrences (' ') = 1)
1446 check_boolean ("occurrences", ("%U %U").occurrences ('a') = 0)
1447 check_boolean ("occurrences", ("%U%U ").occurrences ('%U') = 2)
1448 check_boolean ("occurrences", ("%U%U ").occurrences (' ') = 1)
1449 check_boolean ("occurrences", ("%U%U ").occurrences ('a') = 0)
1450 check_boolean ("occurrences", ("%U ").occurrences ('%U') = 1)
1451 check_boolean ("occurrences", ("%U ").occurrences (' ') = 2)
1452 check_boolean ("occurrences", ("%U ").occurrences ('a') = 0)
1453 check_boolean ("occurrences", (" %U ").occurrences ('%U') = 1)
1454 check_boolean ("occurrences", (" %U ").occurrences (' ') = 2)
1455 check_boolean ("occurrences", (" %U ").occurrences ('a') = 0)
1456 check_boolean ("occurrences", (" %U").occurrences ('%U') = 1)
1457 check_boolean ("occurrences", (" %U").occurrences (' ') = 2)
1458 check_boolean ("occurrences", (" %U").occurrences ('a') = 0)
1459 check_boolean ("occurrences", (" ").occurrences ('%U') = 0)
1460 check_boolean ("occurrences", (" ").occurrences (' ') = 3)
1461 check_boolean ("occurrences", (" ").occurrences ('a') = 0)
1462 end
1463
1464 test_out is
1465 do
1466 check_equality ("out", ("").out, "")
1467 check_equality ("out", ("1").out, "1")
1468 check_equality ("out", ("12").out, "12")
1469 check_equality ("out", ("123").out, "123")
1470 check_equality ("out", ("1234").out, "1234")
1471 check_equality ("out", ("12345").out, "12345")
1472 end
1473
1474 test_plus is
1475 local
1476 is_32: IMMUTABLE_STRING_32
1477 is_8: IMMUTABLE_STRING_8
1478 s_32: STRING_32
1479 s_8: STRING_8
1480 do
1481 is_32 := "12345"
1482 s_32 := "12345"
1483 is_8 := "67890"
1484 s_8 := "67890"
1485 check_equality ("plus", s_8.plus (is_32), "6789012345")
1486 check_equality ("plus", s_8.plus (s_32), "6789012345")
1487 check_equality ("plus", s_8.plus (is_8), "6789067890")
1488 check_equality ("plus", s_8.plus (s_8), "6789067890")
1489 check_equality ("plus", s_8.plus (""), "67890")
1490
1491 s_8 := ""
1492 check_equality ("plus", s_8.plus (is_32), "12345")
1493 check_equality ("plus", s_8.plus (s_32), "12345")
1494 check_equality ("plus", s_8.plus (is_8), "67890")
1495 check_equality ("plus", s_8.plus (s_8), "")
1496 check_equality ("plus", s_8.plus (""), "")
1497
1498 is_32 := ""
1499 s_32 := ""
1500 is_8 := ""
1501 check_equality ("plus", s_8.plus (is_32), "")
1502 check_equality ("plus", s_8.plus (s_32), "")
1503 check_equality ("plus", s_8.plus (is_8), "")
1504 check_equality ("plus", s_8.plus (s_8), "")
1505 check_equality ("plus", s_8.plus (""), "")
1506 end
1507
1508 test_precede is
1509 local
1510 s: STRING_8
1511 do
1512 s := ""
1513 s.precede ('%U')
1514 check_equality ("precede", s, "%U")
1515 s.precede ('a')
1516 check_equality ("precede", s, "a%U")
1517 s.precede ('%N')
1518 check_equality ("precede", s, "%Na%U")
1519 end
1520
1521 test_prepend is
1522 -- Perform test on `prepend'.
1523 local
1524 s: STRING_8
1525 do
1526 s := ""
1527 s.prepend (s)
1528 check_equality ("prepend", s, "")
1529 s.prepend ("")
1530 check_equality ("prepend", s, "")
1531 s.prepend ("abc")
1532 check_equality ("prepend", s, "abc")
1533 s.prepend ("")
1534 check_equality ("prepend", s, "abc")
1535
1536 s := "bar"
1537 s.prepend (s)
1538 check_equality ("prepend", s, "barbar")
1539
1540 s := "bar"
1541 s.prepend ("bar")
1542 check_equality ("prepend", s, "barbar")
1543 end
1544
1545 test_prepend_boolean is
1546 local
1547 s: STRING_8
1548 do
1549 s := ""
1550 s.prepend_boolean (true)
1551 check_equality ("prepend_boolean", s, "True")
1552 s := ""
1553 s.prepend_boolean (false)
1554 check_equality ("prepend_boolean", s, "False")
1555 s.prepend_boolean (true)
1556 check_equality ("prepend_boolean", s, "TrueFalse")
1557 s.prepend_boolean (false)
1558 check_equality ("prepend_boolean", s, "FalseTrueFalse")
1559 end
1560
1561 test_prepend_character is
1562 local
1563 s: STRING_8
1564 do
1565 s := ""
1566 s.prepend_character ('%U')
1567 check_equality ("prepend_character", s, "%U")
1568 s.prepend_character ('a')
1569 check_equality ("prepend_character", s, "a%U")
1570 s.prepend_character (' ')
1571 check_equality ("prepend_character", s, " a%U")
1572 s.prepend_character ('%N')
1573 check_equality ("prepend_character", s, "%N a%U")
1574 end
1575
1576 test_prepend_double is
1577 local
1578 s: STRING_8
1579 do
1580 s := ""
1581 s.prepend_double (0)
1582 check_equality ("prepend_double", s, "0")
1583 s.prepend_double (1)
1584 check_equality ("prepend_double", s, "10")
1585 s.prepend_double (0.5)
1586 check_equality ("prepend_double", s, "0.510")
1587 s.prepend_double (-0.5)
1588 check_equality ("prepend_double", s, "-0.50.510")
1589 end
1590
1591 test_prepend_integer is
1592 local
1593 s: STRING_8
1594 do
1595 s := ""
1596 s.prepend_integer (0)
1597 check_equality ("prepend_integer", s, "0")
1598 s.prepend_integer (1)
1599 check_equality ("prepend_integer", s, "10")
1600 s.prepend_integer (-0x8000_0000)
1601 check_equality ("prepend_integer", s, "-214748364810")
1602 s.prepend_integer (-0x7FFF_FFFF)
1603 check_equality ("prepend_integer", s, "-2147483647-214748364810")
1604 s.prepend_integer (0x7FFF_FFFF)
1605 check_equality ("prepend_integer", s, "2147483647-2147483647-214748364810")
1606 end
1607
1608 test_prepend_real is
1609 local
1610 s: STRING_8
1611 do
1612 s := ""
1613 s.prepend_real (0)
1614 check_equality ("prepend_real", s, "0")
1615 s.prepend_real (1)
1616 check_equality ("prepend_real", s, "10")
1617 s.prepend_real ({REAL_32} 0.5)
1618 check_equality ("prepend_real", s, "0.510")
1619 s.prepend_real ({REAL_32} -0.5)
1620 check_equality ("prepend_real", s, "-0.50.510")
1621 end
1622
1623
1624 test_prepend_string is
1625 local
1626 s: STRING_8
1627 do
1628 s := ""
1629 s.prepend (s)
1630 check_equality ("prepend", s, "")
1631 s.prepend ("")
1632 check_equality ("prepend", s, "")
1633 s.prepend ("abc")
1634 check_equality ("prepend", s, "abc")
1635 s.prepend ("")
1636 check_equality ("prepend", s, "abc")
1637
1638 s := "bar"
1639 s.prepend (s)
1640 check_equality ("prepend", s, "barbar")
1641
1642 s := "bar"
1643 s.prepend ("bar")
1644 check_equality ("prepend", s, "barbar")
1645 end
1646
1647 test_prunable is
1648 do
1649 check_boolean ("prunable", ("").prunable)
1650 check_boolean ("prunable", ("%U").prunable)
1651 check_boolean ("prunable", ("abc").prunable)
1652 end
1653
1654 test_prune is
1655 local
1656 s: STRING_8
1657 do
1658 s := ""
1659 s.prune ('%U')
1660 check_equality ("prune", s, "")
1661 s.prune ('a')
1662 check_equality ("prune", s, "")
1663 s := "%Ua%Ua%Na%U"
1664 s.prune ('%U')
1665 check_equality ("prune", s, "a%Ua%Na%U")
1666 s.prune ('%U')
1667 check_equality ("prune", s, "aa%Na%U")
1668 s.prune ('%U')
1669 check_equality ("prune", s, "aa%Na")
1670 s.prune ('%U')
1671 check_equality ("prune", s, "aa%Na")
1672 s := "%Ua%Ua%Na%U"
1673 s.prune ('a')
1674 check_equality ("prune", s, "%U%Ua%Na%U")
1675 s.prune ('a')
1676 check_equality ("prune", s, "%U%U%Na%U")
1677 s.prune ('a')
1678 check_equality ("prune", s, "%U%U%N%U")
1679 s.prune ('a')
1680 check_equality ("prune", s, "%U%U%N%U")
1681 s := "%Ua%Ua%Na%U"
1682 s.prune ('%N')
1683 check_equality ("prune", s, "%Ua%Uaa%U")
1684 s.prune ('%N')
1685 check_equality ("prune", s, "%Ua%Uaa%U")
1686 end
1687
1688 test_prune_all is
1689 local
1690 s: STRING_8
1691 do
1692 s := ""
1693 s.prune_all ('%U')
1694 check_equality ("prune_all", s, "")
1695 s.prune_all ('a')
1696 check_equality ("prune_all", s, "")
1697 s := "%Ua%Ua%Na%U"
1698 s.prune_all ('%U')
1699 check_equality ("prune_all", s, "aa%Na")
1700 s.prune_all ('%U')
1701 check_equality ("prune_all", s, "aa%Na")
1702 s := "%Ua%Ua%Na%U"
1703 s.prune_all ('a')
1704 check_equality ("prune_all", s, "%U%U%N%U")
1705 s.prune_all ('a')
1706 check_equality ("prune_all", s, "%U%U%N%U")
1707 s := "%Ua%Ua%Na%U"
1708 s.prune_all ('%N')
1709 check_equality ("prune_all", s, "%Ua%Uaa%U")
1710 s.prune_all ('%N')
1711 check_equality ("prune_all", s, "%Ua%Uaa%U")
1712 end
1713
1714 test_prune_all_leading is
1715 local
1716 s: STRING_8
1717 do
1718 s := ""
1719 s.prune_all_leading ('%U')
1720 check_equality ("prune_all_leading", s, "")
1721 s.prune_all_leading ('a')
1722 check_equality ("prune_all_leading", s, "")
1723 s := "%U%U%U"
1724 s.prune_all_leading ('a')
1725 check_equality ("prune_all_leading", s, "%U%U%U")
1726 s.prune_all_leading ('%U')
1727 check_equality ("prune_all_leading", s, "")
1728 s := "aaa"
1729 s.prune_all_leading ('%U')
1730 check_equality ("prune_all_leading", s, "aaa")
1731 s.prune_all_leading ('a')
1732 check_equality ("prune_all_leading", s, "")
1733 s := "%U%Ua%Ua%Na%U"
1734 s.prune_all_leading ('a')
1735 check_equality ("prune_all_leading", s, "%U%Ua%Ua%Na%U")
1736 s.prune_all_leading ('%U')
1737 check_equality ("prune_all_leading", s, "a%Ua%Na%U")
1738 s.prune_all_leading ('%U')
1739 check_equality ("prune_all_leading", s, "a%Ua%Na%U")
1740 s.prune_all_leading ('a')
1741 check_equality ("prune_all_leading", s, "%Ua%Na%U")
1742 end
1743
1744 test_prune_all_trailing is
1745 local
1746 s: STRING_8
1747 do
1748 s := ""
1749 s.prune_all_trailing ('%U')
1750 check_equality ("prune_all_trailing", s, "")
1751 s.prune_all_trailing ('a')
1752 check_equality ("prune_all_trailing", s, "")
1753 s := "%U%U%U"
1754 s.prune_all_trailing ('a')
1755 check_equality ("prune_all_trailing", s, "%U%U%U")
1756 s.prune_all_trailing ('%U')
1757 check_equality ("prune_all_trailing", s, "")
1758 s := "aaa"
1759 s.prune_all_trailing ('%U')
1760 check_equality ("prune_all_trailing", s, "aaa")
1761 s.prune_all_trailing ('a')
1762 check_equality ("prune_all_trailing", s, "")
1763 s := "%U%Ua%Ua%Na%U%U"
1764 s.prune_all_trailing ('a')
1765 check_equality ("prune_all_trailing", s, "%U%Ua%Ua%Na%U%U")
1766 s.prune_all_trailing ('%U')
1767 check_equality ("prune_all_trailing", s, "%U%Ua%Ua%Na")
1768 s.prune_all_trailing ('%U')
1769 check_equality ("prune_all_trailing", s, "%U%Ua%Ua%Na")
1770 s.prune_all_trailing ('a')
1771 check_equality ("prune_all_trailing", s, "%U%Ua%Ua%N")
1772 end
1773
1774 test_put is
1775 local
1776 s: STRING_8
1777 do
1778 s := "a"
1779 s.put ('%U', 1)
1780 check_equality ("put", s, "%U")
1781 s := "12345"
1782 s.put ('c', 3)
1783 s.put ('b', 2)
1784 s.put ('e', 5)
1785 s.put ('d', 4)
1786 s.put ('a', 1)
1787 check_equality ("put", s, "abcde")
1788 s.put ('%U', 3)
1789 check_equality ("put", s, "ab%Ude")
1790 s.put ('3', 3)
1791 check_equality ("put", s, "ab3de")
1792 end
1793
1794 test_remove is
1795 local
1796 s: STRING_8
1797 do
1798 s := "12345"
1799 s.remove (3)
1800 check_equality ("remove", s, "1245")
1801 s.remove (4)
1802 check_equality ("remove", s, "124")
1803 s.remove (1)
1804 check_equality ("remove", s, "24")
1805 s.remove (2)
1806 check_equality ("remove", s, "2")
1807 s.remove (1)
1808 check_equality ("remove", s, "")
1809 end
1810
1811 test_remove_head is
1812 local
1813 s: STRING_8
1814 do
1815 s := ""
1816 s.remove_head (2)
1817 check_equality ("remove_head", s, "")
1818 s := "12345"
1819 s.remove_head (1)
1820 check_equality ("remove_head", s, "2345")
1821 s.remove_head (2)
1822 check_equality ("remove_head", s, "45")
1823 s.remove_head (3)
1824 check_equality ("remove_head", s, "")
1825 s := "12345"
1826 s.remove_head (5)
1827 check_equality ("remove_head", s, "")
1828 end
1829
1830 test_remove_substring is
1831 local
1832 s: STRING_8
1833 do
1834 s := ""
1835 s.remove_substring (1, 0)
1836 check_equality ("remove_substring", s, "")
1837 s := "12345"
1838 s.remove_substring (1, 0)
1839 check_equality ("remove_substring", s, "12345")
1840 s.remove_substring (2, 1)
1841 check_equality ("remove_substring", s, "12345")
1842 s.remove_substring (5, 4)
1843 check_equality ("remove_substring", s, "12345")
1844 s.remove_substring (6, 5)
1845 check_equality ("remove_substring", s, "12345")
1846 s.remove_substring (1, 1)
1847 check_equality ("remove_substring", s, "2345")
1848 s.remove_substring (1, 2)
1849 check_equality ("remove_substring", s, "45")
1850 s.remove_substring (1, 2)
1851 check_equality ("remove_substring", s, "")
1852 s := "12345"
1853 s.remove_substring (2, 2)
1854 check_equality ("remove_substring", s, "1345")
1855 s.remove_substring (2, 4)
1856 check_equality ("remove_substring", s, "1")
1857 s.remove_substring (1, 1)
1858 check_equality ("remove_substring", s, "")
1859 end
1860
1861 test_remove_tail is
1862 local
1863 s: STRING_8
1864 do
1865 s := ""
1866 s.remove_tail (2)
1867 check_equality ("remove_tail", s, "")
1868 s := "12345"
1869 s.remove_tail (1)
1870 check_equality ("remove_tail", s, "1234")
1871 s.remove_tail (2)
1872 check_equality ("remove_tail", s, "12")
1873 s.remove_tail (3)
1874 check_equality ("remove_tail", s, "")
1875 s := "12345"
1876 s.remove_tail (5)
1877 check_equality ("remove_tail", s, "")
1878 end
1879
1880 test_replace_blank is
1881 local
1882 s: STRING_8
1883 do
1884 s := ""
1885 s.replace_blank
1886 check_equality ("replace_blank", s, "")
1887 s := "1"
1888 s.replace_blank
1889 check_equality ("replace_blank", s, " ")
1890 s := "a%Ub%Uc%U"
1891 s.replace_blank
1892 check_equality ("replace_blank", s, " ")
1893 end
1894
1895 test_replace_substring is
1896 -- Perform test on `replace_substring'.
1897 local
1898 s: STRING_8
1899 do
1900 s := "foobar"
1901 s.replace_substring (s, 4, 6)
1902 check_equality ("replace_substring", s, "foofoobar")
1903
1904 s := "foobar"
1905 s.replace_substring ("foobar", 4, 6)
1906 check_equality ("replace_substring", s, "foofoobar")
1907 end
1908
1909 test_replace_substring_all is
1910 local
1911 s: STRING_8
1912 s_orig, s_modif: STRING_8
1913 do
1914 s := "EiffelSoftware Entreprise Edition_5.5"
1915 s.replace_substring_all (" ", "_")
1916 check_equality ("replace_substring_all", s, "EiffelSoftware_ Entreprise Edition_5.5")
1917
1918 s := " EiffelSoftware Entreprise Edition_5.5 "
1919 s.replace_substring_all (" ", "_")
1920 check_equality ("replace_substring_all", s, "_ EiffelSoftware_ Entreprise_ Edition_5.5_ ")
1921
1922 s := " EiffelSoftware Entreprise Edition_5.5 "
1923 s.replace_substring_all (" ", "___")
1924 check_equality ("replace_substring_all", s, "_________EiffelSoftware_________Entreprise_________Edition_5.5_________")
1925
1926 s_orig := "[
1927 #ifdef EIF_WINDOWS
1928 /* On NTFS file system, windows store UTC file stamps in 100 of nanoseconds
1929 * starting from January 1st 0. Converted in seconds, this time is greater
1930 * than 232 therefore we substract the EPOCH date January 1st 1970 to get
1931 * a 32 bits representation of the date.
1932 * FIXME: Manu 01/28/2004: On FAT file system, the date is in local time,
1933 * meaning that the code below does not compensate if you change your timezone
1934 * and will return a different date value for the same stamp just because
1935 * you are in different time zone.
1936 */
1937
1938 /* WARNING: This is using the Ansi version of the Win32 API. Remember
1939 * that if you are doing any change below.
1940 */
1941 static ULARGE_INTEGER epoch_date;
1942 static int done = 0;
1943
1944 WIN32_FIND_DATAA l_find_data;
1945 HANDLE l_file_handle;
1946 ULARGE_INTEGER l_date;
1947
1948 l_file_handle = FindFirstFileA(arg1, &l_find_data);
1949 if (l_file_handle == INVALID_HANDLE_VALUE) {
1950 *(EIF_INTEGER*) $r = -1;
1951 } else {
1952 /* We do not need the file handle anymore, so we close it to
1953 * avoid handle leak. */
1954 FindClose (l_file_handle);
1955 if (done == 0) {
1956 /* Lazy initialization of epoch_date. */
1957 SYSTEMTIME epoch;
1958 FILETIME epoch_file;
1959
1960 done = 1;
1961 memset (&epoch, 0, sizeof(SYSTEMTIME));
1962 epoch.wYear = 1970;
1963 epoch.wMonth = 1;
1964 epoch.wDay = 1;
1965 SystemTimeToFileTime (&epoch, &epoch_file);
1966 memcpy (&epoch_date, &epoch_file, sizeof(ULARGE_INTEGER));
1967 }
1968 memcpy (&l_date, &(l_find_data.ftLastWriteTime), sizeof(ULARGE_INTEGER));
1969 *(EIF_INTEGER*) $r = (EIF_INTEGER) ((l_date.QuadPart -
1970 epoch_date.QuadPart) / RTI64C(10000000));
1971 }
1972 #else
1973 static struct stat info;
1974 *(EIF_INTEGER*) $r = (-1 == stat(arg1,&info)) ? (EIF_INTEGER) -1L :(EIF_INTEGER) info.st_mtime;
1975 #endif
1976 ]"
1977
1978 s_modif := "[
1979 #ifdef EIF_WINDOWS
1980 /* On NTFS file system, windows store UTC file stamps in 100 of nanoseconds
1981 * starting from January 1st 0. Converted in seconds, this time is greater
1982 * than 232 therefore we substract the EPOCH date January 1st 1970 to get
1983 * a 32 bits representation of the date.
1984 * FIXME: Manu 01/28/2004: On FAT file system, the date is in local time,
1985 * meaning that the code below does not compensate if you change your timezone
1986 * and will return a different date value for the same stamp just because
1987 * you are in different time zone.
1988 */
1989
1990 /* WARNING: This is using the Ansi version of the Win32 API. Remember
1991 * that if you are doing any change below.
1992 */
1993 static ULARGE_INTEGER epoch_date;
1994 static int done = 0;
1995
1996 WIN32_FIND_DATAA l_find_data;
1997 HANDLE l_file_handle;
1998 ULARGE_INTEGER l_date;
1999
2000 l_file_handle = FindFirstFileA(arg1, &l_find_data);
2001 if (l_file_handle == INVALID_HANDLE_VALUE) {
2002 *(EIF_INTEGER*) arg2 = -1;
2003 } else {
2004 /* We do not need the file handle anymore, so we close it to
2005 * avoid handle leak. */
2006 FindClose (l_file_handle);
2007 if (done == 0) {
2008 /* Lazy initialization of epoch_date. */
2009 SYSTEMTIME epoch;
2010 FILETIME epoch_file;
2011
2012 done = 1;
2013 memset (&epoch, 0, sizeof(SYSTEMTIME));
2014 epoch.wYear = 1970;
2015 epoch.wMonth = 1;
2016 epoch.wDay = 1;
2017 SystemTimeToFileTime (&epoch, &epoch_file);
2018 memcpy (&epoch_date, &epoch_file, sizeof(ULARGE_INTEGER));
2019 }
2020 memcpy (&l_date, &(l_find_data.ftLastWriteTime), sizeof(ULARGE_INTEGER));
2021 *(EIF_INTEGER*) arg2 = (EIF_INTEGER) ((l_date.QuadPart -
2022 epoch_date.QuadPart) / RTI64C(10000000));
2023 }
2024 #else
2025 static struct stat info;
2026 *(EIF_INTEGER*) arg2 = (-1 == stat(arg1,&info)) ? (EIF_INTEGER) -1L :(EIF_INTEGER) info.st_mtime;
2027 #endif
2028 ]"
2029 s_orig.replace_substring_all ("$r", "arg2")
2030 check_equality ("replace_substring_all", s_orig, s_modif)
2031 end
2032
2033 test_resizable is
2034 do
2035 check_boolean ("resizable", ("").resizable)
2036 check_boolean ("resizable", ("1").resizable)
2037 check_boolean ("resizable", ("12").resizable)
2038 check_boolean ("resizable", ("123").resizable)
2039 end
2040
2041 test_resize is
2042 local
2043 s: STRING_8
2044 do
2045 s := ""
2046 s.resize (0)
2047 check_equality ("resize", s, "")
2048 s.resize (5)
2049 check_equality ("resize", s, "")
2050 s := "12345"
2051 s.resize (5)
2052 check_equality ("resize", s, "12345")
2053 s.resize (10)
2054 check_equality ("resize", s, "12345")
2055 end
2056
2057 test_right_adjust is
2058 local
2059 s: STRING_8
2060 do
2061 s := ""
2062 s.right_adjust
2063 check_equality ("right_adjust", s, "")
2064 s := "%/9/%/10/%/11/%/12/%/13/ "
2065 s.right_adjust
2066 check_equality ("right_adjust", s, "")
2067 s := "abc%/9/%/10/%/11/%/12/%/13/ "
2068 s.right_adjust
2069 check_equality ("right_adjust", s, "abc")
2070 s := "%/9/%/10/%/11/%/12/%/13/ abc"
2071 s.right_adjust
2072 check_equality ("right_adjust", s, "%/9/%/10/%/11/%/12/%/13/ abc")
2073 end
2074
2075 test_right_justify is
2076 local
2077 s: STRING_8
2078 do
2079 s := ""
2080 s.right_justify
2081 check_equality ("right_justify", s, "")
2082 s := "12345"
2083 s.right_justify
2084 check_equality ("right_justify", s, "12345")
2085 s := "abc%/9/%/10/%/11/%/12/%/13/ "
2086 s.right_justify
2087 check_equality ("right_justify", s, " abc")
2088 s := "%/9/%/10/%/11/%/12/%/13/ abc"
2089 s.right_justify
2090 check_equality ("right_justify", s, "%/9/%/10/%/11/%/12/%/13/ abc")
2091 s := "%/9/%/10/%/11/%/12/%/13/ abc%/9/%/10/%/11/%/12/%/13/ "
2092 s.right_justify
2093 check_equality ("right_justify", s, " %/9/%/10/%/11/%/12/%/13/ abc")
2094 end
2095
2096 test_same_string is
2097 local
2098 s: STRING_8
2099 do
2100 s := ""
2101 check_boolean ("same_string", s.same_string (s))
2102 check_boolean ("same_string", s.same_string (""))
2103
2104 s := "12345"
2105 check_boolean ("same_string", s.same_string (s))
2106 check_boolean ("same_string", s.same_string ("12345"))
2107 check_boolean ("same_string", not s.same_string ("123456"))
2108 check_boolean ("same_string", not s.same_string ("123"))
2109 check_boolean ("same_string", not s.same_string (""))
2110
2111 s := "abcdef"
2112 check_boolean ("same_string", not s.same_string ("ABCDEF"))
2113 end
2114
2115 test_same_characters is
2116 local
2117 s: STRING_8
2118 o: STRING_8
2119 do
2120 s := "12345"
2121 o := "234"
2122 check_boolean ("same_characters", s.same_characters (o, 1, 3, 2))
2123 check_boolean ("same_characters", o.same_characters (s, 2, 4, 1))
2124 o := "432"
2125 check_boolean ("same_characters", not s.same_characters (o, 1, 3, 2))
2126 check_boolean ("same_characters", not o.same_characters (s, 2, 4, 1))
2127
2128 s := "abcdef"
2129 o := "BCD"
2130 check_boolean ("same_characters", not s.same_characters (o, 1, 2, 2))
2131 end
2132
2133 test_same_caseless_characters is
2134 local
2135 s: STRING_8
2136 o: STRING_8
2137 do
2138 s := "12345"
2139 o := "234"
2140 check_boolean ("same_caseless_characters", s.same_caseless_characters (o, 1, 3, 2))
2141 check_boolean ("same_caseless_characters", o.same_caseless_characters (s, 2, 4, 1))
2142 o := "432"
2143 check_boolean ("same_caseless_characters", not s.same_caseless_characters (o, 1, 3, 2))
2144 check_boolean ("same_caseless_characters", not o.same_caseless_characters (s, 2, 4, 1))
2145
2146 s := "abcdef"
2147 o := "BCD"
2148 check_boolean ("same_caseless_characters", s.same_caseless_characters (o, 1, 2, 2))
2149 check_boolean ("same_caseless_characters", not s.same_caseless_characters (o, 1, 2, 3))
2150 end
2151
2152 test_same_type is
2153 do
2154 check_boolean ("same_type", ("").same_type (create {STRING_8}.make_empty))
2155 check_boolean ("same_type", ("").same_type (create {STRING_8}.make (10)))
2156 check_boolean ("same_type", ("").same_type ("12345"))
2157 end
2158
2159 test_set is
2160 local
2161 s: STRING_8
2162 do
2163 s := ""
2164 s.set ("", 1, 0)
2165 check_equality ("set", s, "")
2166 s.set ("", 1, 10)
2167 check_equality ("set", s, "")
2168 s.set ("", 10, 1000)
2169 check_equality ("set", s, "")
2170 s.set ("123", 10, 100)
2171 check_equality ("set", s, "")
2172 s.set ("123", 1, 0)
2173 check_equality ("set", s, "")
2174 s.set ("123", 1, -120)
2175 check_equality ("set", s, "")
2176 s.set ("123", 3, 0)
2177 check_equality ("set", s, "")
2178 s.set ("123", 4, 4)
2179 check_equality ("set", s, "")
2180 s.set ("123", 2, 2)
2181 check_equality ("set", s, "2")
2182 s.set ("12345", -100, 100)
2183 check_equality ("set", s, "") -- Current implementation assumes that out-of-range indexes result in empty string
2184 s.set ("12345", 1, 5)
2185 check_equality ("set", s, "12345")
2186 s.set ("12345", 1, 3)
2187 check_equality ("set", s, "123")
2188 s.set ("12345", 3, 5)
2189 check_equality ("set", s, "345")
2190 end
2191
2192 test_share is
2193 local
2194 s: STRING_8
2195 p: STRING_8
2196 do
2197 s := ""
2198 p := "12345"
2199 s.share (p)
2200 check_equality ("share", s, "12345")
2201 p.remove_head (5)
2202 check_equality ("share", p, "")
2203 check_equality ("share", s, "12345")
2204 p.append_string ("abcde")
2205 check_equality ("share", p, "abcde")
2206 check_equality ("share", s, "abcde")
2207 end
2208
2209 test_shared_with is
2210 local
2211 s: STRING_8
2212 p: STRING_8
2213 do
2214 s := ""
2215 check_boolean ("shared_with", not s.shared_with (""))
2216 p := "12345"
2217 check_boolean ("shared_with", not s.shared_with (p))
2218 s.share (p)
2219 check_boolean ("shared_with", s.shared_with (p))
2220 -- `append_string' does not take sharing into account
2221 -- p.append_string ("abc")
2222 -- check_boolean ("shared_with", s.shared_with (p))
2223 p.make_empty
2224 check_boolean ("shared_with", not s.shared_with (p))
2225 end
2226
2227 test_split is
2228 local
2229 s: STRING_8
2230 l: LIST [STRING_8]
2231 do
2232 s := ""
2233 l := s.split ('%U')
2234 check_equality ("split", l.count, 1)
2235 check_equality ("split", l [1], "")
2236 s := "1234543212345"
2237 l := s.split ('%U')
2238 check_equality ("split", l.count, 1)
2239 check_equality ("split", l [1], "1234543212345")
2240 l := s.split ('6')
2241 check_equality ("split", l.count, 1)
2242 check_equality ("split", l [1], "1234543212345")
2243 l := s.split ('1')
2244 check_equality ("split", l.count, 3)
2245 check_equality ("split", l [1], "")
2246 check_equality ("split", l [2], "2345432")
2247 check_equality ("split", l [3], "2345")
2248 l := s.split ('2')
2249 check_equality ("split", l.count, 4)
2250 check_equality ("split", l [1], "1")
2251 check_equality ("split", l [2], "34543")
2252 check_equality ("split", l [3], "1")
2253 check_equality ("split", l [4], "345")
2254 l := s.split ('5')
2255 check_equality ("split", l.count, 3)
2256 check_equality ("split", l [1], "1234")
2257 check_equality ("split", l [2], "4321234")
2258 check_equality ("split", l [3], "")
2259 end
2260
2261 test_starts_with is
2262 local
2263 s: STRING_8
2264 do
2265 s := "1234567890"
2266 check_boolean ("Starts with empty%N", s.starts_with (""))
2267 check_boolean ("Starts with itself%N", s.starts_with (s))
2268 check_boolean ("Starts with its twin%N", s.starts_with (s.twin))
2269 check_boolean ("Not starts with itself twice%N", not s.starts_with (s + s))
2270 check_boolean ("Starts with 123%N", s.starts_with ("123"))
2271 check_boolean ("Not starts with 23%N", not s.starts_with ("23"))
2272 check_boolean ("Not starts with 890%N", not s.starts_with ("890"))
2273 check_boolean ("Not starts with 89%N", not s.starts_with ("89"))
2274 end
2275
2276 test_string is
2277 local
2278 s: STRING_8
2279 do
2280 s := ""
2281 check_boolean ("string", s.string /= s)
2282 check_equality ("string", s.string, s)
2283 check_boolean ("string", not s.string.shared_with (s))
2284 s := "12345"
2285 check_boolean ("string", s.string /= s)
2286 check_equality ("string", s.string, s)
2287 check_boolean ("string", not s.string.shared_with (s))
2288 end
2289
2290 test_subcopy is
2291 -- Perform test on `subcopy'.
2292 local
2293 s: STRING_8
2294 do
2295 s := "foobarfoobar"
2296 s.subcopy (s, 2, 3, 5)
2297 check_equality ("subcopy", s, "fooboofoobar")
2298
2299 s := "foobarfoobar"
2300 s.subcopy ("foobarfoobar", 2, 3, 5)
2301 check_equality ("subcopy", s, "fooboofoobar")
2302
2303 s := "foobarfoobar"
2304 s.subcopy (s, 4, 6, 7)
2305 check_equality ("subcopy", s, "foobarbarbar")
2306
2307 s := "foobarfoobar"
2308 s.subcopy (s, 4, 6, 2)
2309 check_equality ("subcopy", s, "fbararfoobar")
2310 end
2311
2312 test_substring is
2313 local
2314 s: STRING_8
2315 do
2316 s := ""
2317 check_equality ("substring", s.substring (100, 1000), "")
2318 check_equality ("substring", s.substring (-1, 1), "")
2319 check_equality ("substring", s.substring (1, 1), "")
2320 check_equality ("substring", s.substring (1, 0), "")
2321 s := "12345"
2322 check_equality ("substring", s.substring (100, 1000), "")
2323 check_equality ("substring", s.substring (-1, 0), "")
2324 check_equality ("substring", s.substring (-1, 1), "") -- Current implementation assumes that out-of-range indexes result in empty string
2325 check_equality ("substring", s.substring (1, 0), "")
2326 check_equality ("substring", s.substring (1, 5), "12345")
2327 check_equality ("substring", s.substring (3, 5), "345")
2328 check_equality ("substring", s.substring (3, 10), "") -- Current implementation assumes that out-of-range indexes result in empty string
2329 check_equality ("substring", s.substring (-100, 100), "") -- Current implementation assumes that out-of-range indexes result in empty string
2330 end
2331
2332 test_substring_index is
2333 -- Perform test on `substring_index'.
2334 local
2335 s: STRING_8
2336 do
2337 s := "foo"
2338 check_equality ("substring_index", s.substring_index ("", 1), 1)
2339 check_equality ("substring_index", s.substring_index ("", 4), 4)
2340
2341 s := "foobarfoobar"
2342 check_equality ("substring_index", s.substring_index ("bar", 1), 4)
2343 check_equality ("substring_index", s.substring_index ("bar", 4), 4)
2344 check_equality ("substring_index", s.substring_index ("bar", 5), 10)
2345 check_equality ("substring_index", s.substring_index ("bar", 11), 0)
2346 end
2347
2348 test_substring_index_in_bounds is
2349 local
2350 s: STRING_8
2351 do
2352 s := "foo"
2353 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("f", 1, 1), 1)
2354 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("f", 1, 3), 1)
2355 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("f", 2, 3), 0)
2356 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("o", 1, 3), 2)
2357 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("o", 2, 3), 2)
2358 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("o", 3, 3), 3)
2359
2360 s := "foobarfoobar"
2361 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 1, 5), 0)
2362 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 1, 6), 4)
2363 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 3, 6), 4)
2364 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 4, 6), 4)
2365 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 4, 10), 4)
2366 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 5, 6), 0)
2367 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 5, 8), 0)
2368 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 5, 11), 0)
2369 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 5, 12), 10)
2370 check_equality ("substring_index_in_bounds", s.substring_index_in_bounds ("bar", 11, 12), 0)
2371 end
2372
2373 test_tagged_out is
2374 do
2375 check_boolean ("tagged_out", ("").tagged_out /= Void)
2376 check_boolean ("tagged_out", not equal (("").tagged_out, ""))
2377 check_boolean ("tagged_out", ("12345").tagged_out /= Void)
2378 check_boolean ("tagged_out", not equal (("12345").tagged_out, ""))
2379 end
2380
2381 test_three_way_comparison is
2382 local
2383 s: STRING_8
2384 p: STRING_8
2385 do
2386 s := "12345"
2387 p := "12345"
2388 check_boolean ("three_way_comparison", s.three_way_comparison (s) = 0)
2389 check_boolean ("three_way_comparison", s.three_way_comparison (p) = 0)
2390 p.append_character ('a')
2391 check_boolean ("three_way_comparison", s.three_way_comparison (p) = -1)
2392 check_boolean ("three_way_comparison", p.three_way_comparison (s) = 1)
2393 p := "12045"
2394 check_boolean ("three_way_comparison", s.three_way_comparison (p) = 1)
2395 check_boolean ("three_way_comparison", p.three_way_comparison (s) = -1)
2396 s := "123"
2397 check_boolean ("three_way_comparison", s.three_way_comparison (p) = 1)
2398 check_boolean ("three_way_comparison", p.three_way_comparison (s) = -1)
2399
2400 s := ""
2401 p := ""
2402 check_boolean ("three_way_comparison", s.three_way_comparison (s) = 0)
2403 check_boolean ("three_way_comparison", s.three_way_comparison (p) = 0)
2404 p.append_character ('a')
2405 check_boolean ("three_way_comparison", s.three_way_comparison (p) = -1)
2406 check_boolean ("three_way_comparison", p.three_way_comparison (s) = 1)
2407 end
2408
2409 test_to_c is
2410 do
2411 if not {PLATFORM}.is_dotnet then
2412 check_boolean ("to_c", ("").to_c /= Void)
2413 check_boolean ("to_c", ("123").to_c /= Void)
2414 end
2415 end
2416
2417 test_to_cil is
2418 do
2419 if {PLATFORM}.is_dotnet then
2420 check_boolean ("to_cil", ("").to_cil /= Void)
2421 check_boolean ("to_cil", ("123").to_cil /= Void)
2422 end
2423 end
2424
2425 test_to_double is
2426 do
2427 check_equality ("to_double", ("0").to_double, {DOUBLE} 0.0)
2428 check_equality ("to_double", ("1").to_double, {DOUBLE} 1.0)
2429 check_equality ("to_double", ("123").to_double, {DOUBLE} 123.0)
2430 check_equality ("to_double", ("0.75").to_double, {DOUBLE} 0.75)
2431 check_equality ("to_double", ("-348.75").to_double, {DOUBLE} -348.75)
2432 check_equality ("to_double", ("62.5e-3").to_double, {DOUBLE} 62.5e-3)
2433 check_equality ("to_double", ("1.e-4").to_double, {DOUBLE} 1.e-4)
2434 check_equality ("to_double", ("1.e-4").to_double, {DOUBLE} 0.0001)
2435 check_equality ("to_double", ("62.5e-3").to_double, {DOUBLE} 62.5e-3)
2436 end
2437
2438 test_to_integer is
2439 do
2440 -- Unsigned integers
2441 check_equality ("to_integer", ("000000").to_integer, 0)
2442 check_equality ("to_integer", ("000000000000000000001").to_integer, 1)
2443 check_equality ("to_integer", ("127").to_integer, 127)
2444 check_equality ("to_integer", ("128").to_integer, 128)
2445 check_equality ("to_integer", ("255").to_integer, 255)
2446 check_equality ("to_integer", ("256").to_integer, 256)
2447 check_equality ("to_integer", ("32767").to_integer, 32767)
2448 check_equality ("to_integer", ("32768").to_integer, 32768)
2449 check_equality ("to_integer", ("65535").to_integer, 65535)
2450 check_equality ("to_integer", ("65536").to_integer, 65536)
2451 check_equality ("to_integer", ("2147483647").to_integer, 2147483647)
2452 -- Positive integers
2453 check_equality ("to_integer", ("+000000").to_integer, 0)
2454 check_equality ("to_integer", ("+000000000000000000001").to_integer, 1)
2455 check_equality ("to_integer", ("+127").to_integer, 127)
2456 check_equality ("to_integer", ("+128").to_integer, 128)
2457 check_equality ("to_integer", ("+255").to_integer, 255)
2458 check_equality ("to_integer", ("+256").to_integer, 256)
2459 check_equality ("to_integer", ("+32767").to_integer, 32767)
2460 check_equality ("to_integer", ("+32768").to_integer, 32768)
2461 check_equality ("to_integer", ("+65535").to_integer, 65535)
2462 check_equality ("to_integer", ("+65536").to_integer, 65536)
2463 check_equality ("to_integer", ("+2147483647").to_integer, 2147483647)
2464 -- Negative integers
2465 check_equality ("to_integer", ("-000000").to_integer, 0)
2466 check_equality ("to_integer", ("-000000000000000000001").to_integer, -1)
2467 check_equality ("to_integer", ("-127").to_integer, -127)
2468 check_equality ("to_integer", ("-128").to_integer, -128)
2469 check_equality ("to_integer", ("-255").to_integer, -255)
2470 check_equality ("to_integer", ("-256").to_integer, -256)
2471 check_equality ("to_integer", ("-32767").to_integer, -32767)
2472 check_equality ("to_integer", ("-32768").to_integer, -32768)
2473 check_equality ("to_integer", ("-65535").to_integer, -65535)
2474 check_equality ("to_integer", ("-65536").to_integer, -65536)
2475 check_equality ("to_integer", ("-2147483647").to_integer, -2147483647)
2476 check_equality ("to_integer", ("-2147483648").to_integer, -2147483648)
2477 end
2478
2479 test_to_integer_64 is
2480 do
2481 -- Unsigned integers
2482 check_equality ("to_integer_64", ("000000").to_integer_64, {INTEGER_64} 0)
2483 check_equality ("to_integer_64", ("000000000000000000001").to_integer_64, {INTEGER_64} 1)
2484 check_equality ("to_integer_64", ("127").to_integer_64, {INTEGER_64} 127)
2485 check_equality ("to_integer_64", ("128").to_integer_64, {INTEGER_64} 128)
2486 check_equality ("to_integer_64", ("255").to_integer_64, {INTEGER_64} 255)
2487 check_equality ("to_integer_64", ("256").to_integer_64, {INTEGER_64} 256)
2488 check_equality ("to_integer_64", ("32767").to_integer_64, {INTEGER_64} 32767)
2489 check_equality ("to_integer_64", ("32768").to_integer_64, {INTEGER_64} 32768)
2490 check_equality ("to_integer_64", ("65535").to_integer_64, {INTEGER_64} 65535)
2491 check_equality ("to_integer_64", ("65536").to_integer_64, {INTEGER_64} 65536)
2492 check_equality ("to_integer_64", ("2147483647").to_integer_64, {INTEGER_64} 2147483647)
2493 check_equality ("to_integer_64", ("2147483648").to_integer_64, {INTEGER_64} 2147483648)
2494 check_equality ("to_integer_64", ("9223372036854775807").to_integer_64, {INTEGER_64} 0x7FFF_FFFF_FFFF_FFFF)
2495 -- Positive integers
2496 check_equality ("to_integer_64", ("+000000").to_integer_64, {INTEGER_64} 0)
2497 check_equality ("to_integer_64", ("+000000000000000000001").to_integer_64, {INTEGER_64} 1)
2498 check_equality ("to_integer_64", ("+127").to_integer_64, {INTEGER_64} 127)
2499 check_equality ("to_integer_64", ("+128").to_integer_64, {INTEGER_64} 128)
2500 check_equality ("to_integer_64", ("+255").to_integer_64, {INTEGER_64} 255)
2501 check_equality ("to_integer_64", ("+256").to_integer_64, {INTEGER_64} 256)
2502 check_equality ("to_integer_64", ("+32767").to_integer_64, {INTEGER_64} 32767)
2503 check_equality ("to_integer_64", ("+32768").to_integer_64, {INTEGER_64} 32768)
2504 check_equality ("to_integer_64", ("+65535").to_integer_64, {INTEGER_64} 65535)
2505 check_equality ("to_integer_64", ("+65536").to_integer_64, {INTEGER_64} 65536)
2506 check_equality ("to_integer_64", ("+2147483647").to_integer_64, {INTEGER_64} 2147483647)
2507 check_equality ("to_integer_64", ("+2147483648").to_integer_64, {INTEGER_64} 2147483648)
2508 check_equality ("to_integer_64", ("+9223372036854775807").to_integer_64, {INTEGER_64} 0x7FFF_FFFF_FFFF_FFFF)
2509 -- Negative integers
2510 check_equality ("to_integer_64", ("-000000").to_integer_64, {INTEGER_64} 0)
2511 check_equality ("to_integer_64", ("-000000000000000000001").to_integer_64, {INTEGER_64} -1)
2512 check_equality ("to_integer_64", ("-127").to_integer_64, {INTEGER_64} -127)
2513 check_equality ("to_integer_64", ("-128").to_integer_64, {INTEGER_64} -128)
2514 check_equality ("to_integer_64", ("-255").to_integer_64, {INTEGER_64} -255)
2515 check_equality ("to_integer_64", ("-256").to_integer_64, {INTEGER_64} -256)
2516 check_equality ("to_integer_64", ("-32767").to_integer_64, {INTEGER_64} -32767)
2517 check_equality ("to_integer_64", ("-32768").to_integer_64, {INTEGER_64} -32768)
2518 check_equality ("to_integer_64", ("-65535").to_integer_64, {INTEGER_64} -65535)
2519 check_equality ("to_integer_64", ("-65536").to_integer_64, {INTEGER_64} -65536)
2520 check_equality ("to_integer_64", ("-2147483647").to_integer_64, {INTEGER_64} -2147483647)
2521 check_equality ("to_integer_64", ("-2147483648").to_integer_64, {INTEGER_64} -2147483648)
2522 check_equality ("to_integer_64", ("-9223372036854775807").to_integer_64, {INTEGER_64} -0x7FFF_FFFF_FFFF_FFFF)
2523 check_equality ("to_integer_64", ("-9223372036854775808").to_integer_64, {INTEGER_64} -0x8000_0000_0000_0000)
2524 end
2525
2526 test_to_lower is
2527 local
2528 s: STRING_8
2529 do
2530 s := ""
2531 s.to_lower
2532 check_equality ("to_lower", s, "")
2533 s := "123ABC456"
2534 s.to_lower
2535 check_equality ("to_lower", s, "123abc456")
2536 s.to_lower
2537 check_equality ("to_lower", s, "123abc456")
2538 s := "ABC %T%U %F DEF"
2539 s.to_lower
2540 check_equality ("to_lower", s, "abc %T%U %F def")
2541 s.to_lower
2542 check_equality ("to_lower", s, "abc %T%U %F def")
2543 end
2544
2545 test_to_real is
2546 do
2547 check_equality ("to_real", ("0").to_real, {REAL} 0.0)
2548 check_equality ("to_real", ("1").to_real, {REAL} 1.0)
2549 check_equality ("to_real", ("123").to_real, {REAL} 123.0)
2550 check_equality ("to_real", ("0.75").to_real, {REAL} 0.75)
2551 check_equality ("to_real", ("-348.75").to_real, {REAL} -348.75)
2552 check_equality ("to_real", ("62.5e-3").to_real, {REAL} 62.5e-3)
2553 end
2554
2555 test_to_upper is
2556 local
2557 s: STRING_8
2558 do
2559 s := ""
2560 s.to_upper
2561 check_equality ("to_upper", s, "")
2562 s := "123abc456"
2563 s.to_upper
2564 check_equality ("to_upper", s, "123ABC456")
2565 s.to_upper
2566 check_equality ("to_upper", s, "123ABC456")
2567 s := "abc %T%U %F def"
2568 s.to_upper
2569 check_equality ("to_upper", s, "ABC %T%U %F DEF")
2570 s.to_upper
2571 check_equality ("to_upper", s, "ABC %T%U %F DEF")
2572 end
2573
2574 test_trim
2575 local
2576 s: STRING_8
2577 count: like {STRING_8}.count
2578 capacity: like {STRING_8}.count
2579 do
2580 s := {STRING_8} ""
2581 s.trim
2582 check_equality ("resize", s, {STRING_8} "")
2583 create s.make (5)
2584 capacity := 5
2585 count := 0
2586 check_equality ("resize", s, {STRING_8} "")
2587 check_equality ("resize", s.count, count)
2588 check_equality ("resize", s.capacity, capacity)
2589 s.trim
2590 capacity := count
2591 check_equality ("resize", s, {STRING_8} "")
2592 check_equality ("resize", s.count, count)
2593 check_equality ("resize", s.capacity, capacity)
2594 create s.make (5)
2595 capacity := 5
2596 s.extend ('1')
2597 s.extend ('2')
2598 count := 2
2599 check_equality ("resize", s, {STRING_8} "12")
2600 check_equality ("resize", s.count, count)
2601 check_equality ("resize", s.capacity, capacity)
2602 s.trim
2603 capacity := count
2604 check_equality ("resize", s, {STRING_8} "12")
2605 check_equality ("resize", s.count, count)
2606 check_equality ("resize", s.capacity, capacity)
2607 create s.make (3)
2608 capacity := 3
2609 s.extend ('1')
2610 s.extend ('2')
2611 s.extend ('3')
2612 count := 3
2613 check_equality ("resize", s, {STRING_8} "123")
2614 check_equality ("resize", s.count, count)
2615 check_equality ("resize", s.capacity, capacity)
2616 s.trim
2617 check_equality ("resize", s, {STRING_8} "123")
2618 check_equality ("resize", s.count, count)
2619 check_equality ("resize", s.capacity, capacity)
2620 end
2621
2622 test_twin is
2623 local
2624 s: STRING_8
2625 do
2626 s := ""
2627 check_equality ("twin", s.twin, "")
2628 check_boolean ("twin", s /= s.twin)
2629 check_boolean ("twin", not s.shared_with (s.twin))
2630 s := "12345"
2631 check_equality ("twin", s.twin, "12345")
2632 check_boolean ("twin", s /= s.twin)
2633 check_boolean ("twin", not s.shared_with (s.twin))
2634 end
2635
2636 test_valid_index is
2637 do
2638 check_boolean ("valid_index", not ("").valid_index (-1))
2639 check_boolean ("valid_index", not ("").valid_index (0))
2640 check_boolean ("valid_index", not ("").valid_index (1))
2641 check_boolean ("valid_index", not ("").valid_index (2))
2642 check_boolean ("valid_index", not ("123").valid_index (-1))
2643 check_boolean ("valid_index", not ("123").valid_index (0))
2644 check_boolean ("valid_index", ("123").valid_index (1))
2645 check_boolean ("valid_index", ("123").valid_index (2))
2646 check_boolean ("valid_index", ("123").valid_index (3))
2647 check_boolean ("valid_index", not ("123").valid_index (4))
2648 end
2649
2650 test_wipe_out is
2651 local
2652 s: STRING_8
2653 do
2654 s := ""
2655 s.wipe_out
2656 check_equality ("wipe_out", s, "")
2657 s := "12345"
2658 s.wipe_out
2659 check_equality ("wipe_out", s, "")
2660 end
2661
2662 feature {NONE} -- Checking
2663
2664 check_equality (a_name: STRING; a, b: ANY) is
2665 -- If `a' and `b' are not equal print something on the console.
2666 require
2667 a_name_not_void: a_name /= Void
2668 do
2669 if not equal (a, b) then
2670 io.put_string ("Not OK: " + a_name)
2671 io.put_new_line
2672 end
2673 end
2674
2675 check_boolean (a_name: STRING; b: BOOLEAN) is
2676 -- If `a' and `b' are not equal print something on the console.
2677 require
2678 a_name_not_void: a_name /= Void
2679 do
2680 if not b then
2681 io.put_string ("Not OK: " + a_name)
2682 io.put_new_line
2683 end
2684 end
2685
2686 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.23