Last change
on this file since aae9c17 was
f54e6ec,
checked in by Michael Brooks <mlbrooks@…>, 14 months ago
|
Port basic input-manipulator test from cstring to string and fix resulting bug.
Bug was ignore(...s...) overwriting s with garbage.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[f54e6ec] | 1 | |
---|
| 2 | #include <fstream.hfa> |
---|
| 3 | #include <collections/string.hfa> |
---|
| 4 | |
---|
| 5 | int main() { |
---|
| 6 | /* Keep harmonized with io/manipulatorsInput */ |
---|
| 7 | { |
---|
| 8 | string s = "yyyyyyyyyyyyyyyyyyyy"; |
---|
| 9 | char sk[] = "abc"; |
---|
| 10 | sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; |
---|
| 11 | sin | s; sout | "2" | s; |
---|
| 12 | sin | ignore( s ); sout | "3" | s; |
---|
| 13 | sin | wdi( 8, s ); sout | "4" | s; |
---|
| 14 | sin | ignore( wdi( 8, s ) ); sout | "5" | s; |
---|
| 15 | |
---|
| 16 | sin | incl( "abc", s ); sout | "6" | s; |
---|
| 17 | sin | excl( "abc", s ); sout | "7" | s; |
---|
| 18 | sin | ignore( incl( "abc", s ) ); sout | "8" | s; |
---|
| 19 | sin | ignore( excl( "abc", s ) ); sout | "9" | s; |
---|
| 20 | sin | incl( "abc", wdi( 8, s ) ); sout | "10" | s; |
---|
| 21 | sin | excl( "abc", wdi( 8, s ) ); sout | "11" | s; |
---|
| 22 | sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; |
---|
| 23 | sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; |
---|
| 24 | } |
---|
| 25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.