summaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/jsonpath/rewrapper/ut/re2_ut.cpp
blob: 0e4d9e28897938049c5d0fa4dd7fdad12b0ff95b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <yql/essentials/minikql/jsonpath/rewrapper/re.h>
#include <yql/essentials/minikql/jsonpath/rewrapper/proto/serialization.pb.h>

#include <library/cpp/testing/unittest/registar.h>

namespace NReWrapper {
namespace NDispatcher {

Y_UNIT_TEST_SUITE(ReWrapperDispatcherRe2) {
    Y_UNIT_TEST(Serialization) {
        auto w1 = Compile("[0-9]+", 0, NReWrapper::TSerialization::kRe2);
        auto string = w1->Serialize();

        auto w2 = Deserialize(string);
        UNIT_ASSERT_VALUES_EQUAL(w1->Matches("123"), true);
        UNIT_ASSERT_VALUES_EQUAL(w1->Matches("abc"), false);
        UNIT_ASSERT_VALUES_EQUAL(w2->Matches("123"), true);
        UNIT_ASSERT_VALUES_EQUAL(w2->Matches("abc"), false);
    }
}

}
}