Home | History | Annotate | Download | only in re.results.state
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <regex>
     11 
     12 // class match_results<BidirectionalIterator, Allocator>
     13 
     14 // bool ready() const;
     15 
     16 #include <regex>
     17 #include <cassert>
     18 #include "test_macros.h"
     19 
     20 void
     21 test1()
     22 {
     23     std::match_results<const char*> m;
     24     const char s[] = "abcdefghijk";
     25     assert(m.ready() == false);
     26     std::regex_search(s, m, std::regex("cd((e)fg)hi"));
     27     assert(m.ready() == true);
     28 }
     29 
     30 void
     31 test2()
     32 {
     33     std::match_results<const char*> m;
     34     const char s[] = "abcdefghijk";
     35     assert(m.ready() == false);
     36     std::regex_search(s, m, std::regex("z"));
     37     assert(m.ready() == true);
     38 }
     39 
     40 int main()
     41 {
     42     test1();
     43     test2();
     44 }
     45