source: tests/collections/string-istream-manip.cfa @ cf34e82

Last change on this file since cf34e82 was ff56dd2e, checked in by Michael Brooks <mlbrooks@…>, 14 months ago

Duplicate manipulator read-to-string code for string_res, and test.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1
2#include <fstream.hfa>
3#include <collections/string.hfa>
4#include <collections/string_res.hfa>
5
6int main() {
7    /* Keep harmonized with io/manipulatorsInput */
8    {
9        string s = "yyyyyyyyyyyyyyyyyyyy";
10        char sk[] = "abc";
11        sin | "abc " | skip( sk ) | skip( 5 );          sout | "1" | s;
12        sin | s;                                        sout | "2" | s;
13        sin | ignore( s );                              sout | "3" | s;
14        sin | wdi( 8, s );                              sout | "4" | s;
15        sin | ignore( wdi( 8, s ) );                    sout | "5" | s;
16
17        sin | incl( "abc", s );                         sout | "6" | s;
18        sin | excl( "abc", s );                         sout | "7" | s;
19        sin | ignore( incl( "abc", s ) );               sout | "8" | s;
20        sin | ignore( excl( "abc", s ) );               sout | "9" | s;
21        sin | incl( "abc", wdi( 8, s ) );               sout | "10" | s;
22        sin | excl( "abc", wdi( 8, s ) );               sout | "11" | s;
23        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
24        sin | ignore( excl( "abc", wdi( 8, s ) ) );     sout | "13" | s;
25    }
26    {
27        string_res s = "yyyyyyyyyyyyyyyyyyyy";
28        char sk[] = "abc";
29        sin | "abc " | skip( sk ) | skip( 5 );          sout | "1" | s;
30        sin | s;                                        sout | "2" | s;
31        sin | ignore( s );                              sout | "3" | s;
32        sin | wdi( 8, s );                              sout | "4" | s;
33        sin | ignore( wdi( 8, s ) );                    sout | "5" | s;
34
35        sin | incl( "abc", s );                         sout | "6" | s;
36        sin | excl( "abc", s );                         sout | "7" | s;
37        sin | ignore( incl( "abc", s ) );               sout | "8" | s;
38        sin | ignore( excl( "abc", s ) );               sout | "9" | s;
39        sin | incl( "abc", wdi( 8, s ) );               sout | "10" | s;
40        sin | excl( "abc", wdi( 8, s ) );               sout | "11" | s;
41        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
42        sin | ignore( excl( "abc", wdi( 8, s ) ) );     sout | "13" | s;
43    }
44}
Note: See TracBrowser for help on using the repository browser.