re2_ut.cpp 722 B

1234567891011121314151617181920212223
  1. #include <yql/essentials/minikql/jsonpath/rewrapper/re.h>
  2. #include <yql/essentials/minikql/jsonpath/rewrapper/proto/serialization.pb.h>
  3. #include <library/cpp/testing/unittest/registar.h>
  4. namespace NReWrapper {
  5. namespace NDispatcher {
  6. Y_UNIT_TEST_SUITE(ReWrapperDispatcherRe2) {
  7. Y_UNIT_TEST(Serialization) {
  8. auto w1 = Compile("[0-9]+", 0, NReWrapper::TSerialization::kRe2);
  9. auto string = w1->Serialize();
  10. auto w2 = Deserialize(string);
  11. UNIT_ASSERT_VALUES_EQUAL(w1->Matches("123"), true);
  12. UNIT_ASSERT_VALUES_EQUAL(w1->Matches("abc"), false);
  13. UNIT_ASSERT_VALUES_EQUAL(w2->Matches("123"), true);
  14. UNIT_ASSERT_VALUES_EQUAL(w2->Matches("abc"), false);
  15. }
  16. }
  17. }
  18. }