xref: /aosp_15_r20/external/cronet/third_party/re2/src/testinstall.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2008 The RE2 Authors.  All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 
5 #include <stdio.h>
6 #include <re2/filtered_re2.h>
7 #include <re2/re2.h>
8 
main()9 int main() {
10   re2::FilteredRE2 f;
11   int id;
12   f.Add("a.*b.*c", RE2::DefaultOptions, &id);
13   std::vector<std::string> v;
14   f.Compile(&v);
15   std::vector<int> ids;
16   f.FirstMatch("abbccc", ids);
17 
18   int n;
19   if (RE2::FullMatch("axbyc", "a.*b.*c") &&
20       RE2::PartialMatch("foo123bar", "(\\d+)", &n) && n == 123) {
21     printf("PASS\n");
22     return 0;
23   }
24 
25   printf("FAIL\n");
26   return 2;
27 }
28