aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/vector_ut.cpp
blob: 9c4222f9ee2f405c60ff606d7023a938a71c8f16 (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
33
34
35
36
37
38
#include <library/cpp/testing/unittest/registar.h>
#include <util/charset/wide.h>

#include "cast.h"
#include "vector.h"

Y_UNIT_TEST_SUITE(TStringJoinTest) { 
    Y_UNIT_TEST(Test1) { 
        TVector<TUtf16String> v;

        UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring("")), ToWtring(""));
    }

    Y_UNIT_TEST(Test2) { 
        TVector<TUtf16String> v;

        v.push_back(ToWtring("1"));
        v.push_back(ToWtring("2"));

        UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring(" ")), ToWtring("1 2"));
    }

    Y_UNIT_TEST(Test3) { 
        TVector<TUtf16String> v;

        v.push_back(ToWtring("1"));
        v.push_back(ToWtring("2"));

        UNIT_ASSERT_EQUAL(JoinStrings(v, 1, 10, ToWtring(" ")), ToWtring("2"));
    }

    Y_UNIT_TEST(TestJoinWStrings) { 
        const TUtf16String str = u"Яндекс";
        const TVector<TUtf16String> v(1, str);

        UNIT_ASSERT_EQUAL(JoinStrings(v, TUtf16String()), str);
    }
}