testinstall.cc 621 B

123456789101112131415161718192021222324252627
  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. #include <stdio.h>
  5. #include <re2/filtered_re2.h>
  6. #include <re2/re2.h>
  7. int main() {
  8. re2::FilteredRE2 f;
  9. int id;
  10. f.Add("a.*b.*c", RE2::DefaultOptions, &id);
  11. std::vector<std::string> v;
  12. f.Compile(&v);
  13. std::vector<int> ids;
  14. f.FirstMatch("abbccc", ids);
  15. int n;
  16. if (RE2::FullMatch("axbyc", "a.*b.*c") &&
  17. RE2::PartialMatch("foo123bar", "(\\d+)", &n) && n == 123) {
  18. printf("PASS\n");
  19. return 0;
  20. }
  21. printf("FAIL\n");
  22. return 2;
  23. }