~ubuntu-branches/ubuntu/trusty/libc++/trusty

« back to all changes in this revision

Viewing changes to libcxx/test/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 15:25:24 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20140119152524-6vvkhtareysbhhs3
Tags: 1.0~svn199600-1
* New snapshot release
* Standards-Version updated to 3.9.5
* Introduce package libc++-helpers (Closes: #718637)
* Rename libc++-src => libc++-test
* Rename libc++abi-src => libc++abi-test
* For both, remove the sources from the packages (apt-get source libc++)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        std::regex phone_numbers("\\d{3}-\\d{4}");
23
23
        const char phone_book[] = "555-1234, 555-2345, 555-3456";
24
24
        std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers);
25
 
        assert(i != std::cregex_iterator());
26
 
        assert((*i).size() == 1);
27
 
        assert((*i).position() == 0);
28
 
        assert((*i).str() == "555-1234");
29
 
        i++;
30
 
        assert(i != std::cregex_iterator());
31
 
        assert((*i).size() == 1);
32
 
        assert((*i).position() == 10);
33
 
        assert((*i).str() == "555-2345");
34
 
        i++;
35
 
        assert(i != std::cregex_iterator());
36
 
        assert((*i).size() == 1);
37
 
        assert((*i).position() == 20);
38
 
        assert((*i).str() == "555-3456");
39
 
        i++;
40
 
        assert(i == std::cregex_iterator());
 
25
        std::cregex_iterator i2 = i;
 
26
        assert(i != std::cregex_iterator());
 
27
        assert(i2!= std::cregex_iterator());
 
28
        assert((*i).size() == 1);
 
29
        assert((*i).position() == 0);
 
30
        assert((*i).str() == "555-1234");
 
31
        assert((*i2).size() == 1);
 
32
        assert((*i2).position() == 0);
 
33
        assert((*i2).str() == "555-1234");
 
34
        i++;
 
35
        assert(i != std::cregex_iterator());
 
36
        assert(i2!= std::cregex_iterator());
 
37
        assert((*i).size() == 1);
 
38
        assert((*i).position() == 10);
 
39
        assert((*i).str() == "555-2345");
 
40
        assert((*i2).size() == 1);
 
41
        assert((*i2).position() == 0);
 
42
        assert((*i2).str() == "555-1234");
 
43
        i++;
 
44
        assert(i != std::cregex_iterator());
 
45
        assert(i2!= std::cregex_iterator());
 
46
        assert((*i).size() == 1);
 
47
        assert((*i).position() == 20);
 
48
        assert((*i).str() == "555-3456");
 
49
        assert((*i2).size() == 1);
 
50
        assert((*i2).position() == 0);
 
51
        assert((*i2).str() == "555-1234");
 
52
        i++;
 
53
        assert(i == std::cregex_iterator());
 
54
        assert(i2!= std::cregex_iterator());
 
55
        assert((*i2).size() == 1);
 
56
        assert((*i2).position() == 0);
 
57
        assert((*i2).str() == "555-1234");
 
58
    }
 
59
    {
 
60
        std::regex phone_numbers("\\d{3}-\\d{4}");
 
61
        const char phone_book[] = "555-1234, 555-2345, 555-3456";
 
62
        std::cregex_iterator i(std::begin(phone_book), std::end(phone_book), phone_numbers);
 
63
        std::cregex_iterator i2 = i;
 
64
        assert(i != std::cregex_iterator());
 
65
        assert(i2!= std::cregex_iterator());
 
66
        assert((*i).size() == 1);
 
67
        assert((*i).position() == 0);
 
68
        assert((*i).str() == "555-1234");
 
69
        assert((*i2).size() == 1);
 
70
        assert((*i2).position() == 0);
 
71
        assert((*i2).str() == "555-1234");
 
72
        ++i;
 
73
        assert(i != std::cregex_iterator());
 
74
        assert(i2!= std::cregex_iterator());
 
75
        assert((*i).size() == 1);
 
76
        assert((*i).position() == 10);
 
77
        assert((*i).str() == "555-2345");
 
78
        assert((*i2).size() == 1);
 
79
        assert((*i2).position() == 0);
 
80
        assert((*i2).str() == "555-1234");
 
81
        ++i;
 
82
        assert(i != std::cregex_iterator());
 
83
        assert(i2!= std::cregex_iterator());
 
84
        assert((*i).size() == 1);
 
85
        assert((*i).position() == 20);
 
86
        assert((*i).str() == "555-3456");
 
87
        assert((*i2).size() == 1);
 
88
        assert((*i2).position() == 0);
 
89
        assert((*i2).str() == "555-1234");
 
90
        ++i;
 
91
        assert(i == std::cregex_iterator());
 
92
        assert(i2!= std::cregex_iterator());
 
93
        assert((*i2).size() == 1);
 
94
        assert((*i2).position() == 0);
 
95
        assert((*i2).str() == "555-1234");
41
96
    }
42
97
}