aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/unicode/normalization/ut/normalization_ut.cpp
blob: 54d4940a2681d56d5748c82941a34dffff33c2d7 (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
24
25
26
27
28
29
30
31
32
#include <library/cpp/testing/unittest/registar.h>

#include <util/charset/wide.h>

#include <library/cpp/unicode/normalization/normalization.h>

Y_UNIT_TEST_SUITE(TUnicodeNormalizationTest) {
    template <NUnicode::ENormalization NormType>
    void TestInit() {
        NUnicode::TNormalizer<NormType> normalizer;
        TString s("упячка detected");
        TUtf16String w;
        UTF8ToWide(s, w);
        normalizer.Normalize(w);
    }

    Y_UNIT_TEST(TestInitNFD) {
        TestInit<NUnicode::NFD>();
    }

    Y_UNIT_TEST(TestInitNFC) {
        TestInit<NUnicode::NFC>();
    }

    Y_UNIT_TEST(TestInitNFKD) {
        TestInit<NUnicode::NFKD>();
    }

    Y_UNIT_TEST(TestInitNFKC) {
        TestInit<NUnicode::NFKC>();
    }
}