aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/lower_case/hash_ops_ut.cpp
blob: 645ef7bb5ccf9e4a5a70df44e151ad0285990b4f (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
#include "hash_ops.h"

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

Y_UNIT_TEST_SUITE(TestCIHash) { 
    Y_UNIT_TEST(TestYHash1) { 
        THashMap<TStringBuf, int, TCIOps, TCIOps> h;

        h["Ab"] = 1;
        h["aB"] = 2;

        UNIT_ASSERT_VALUES_EQUAL(h.size(), 1);
        UNIT_ASSERT_VALUES_EQUAL(h["ab"], 2);
    }

    Y_UNIT_TEST(TestYHash2) { 
        THashMap<const char*, int, TCIOps, TCIOps> h;

        h["Ab"] = 1;
        h["aB"] = 2;

        UNIT_ASSERT_VALUES_EQUAL(h.size(), 1);
        UNIT_ASSERT_VALUES_EQUAL(h["ab"], 2);

        h["Bc"] = 2;
        h["bC"] = 3;

        UNIT_ASSERT_VALUES_EQUAL(h.size(), 2);
        UNIT_ASSERT_VALUES_EQUAL(h["bc"], 3);
    }

    Y_UNIT_TEST(Test1) { 
        UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3")));
        UNIT_ASSERT(TCIOps()("aBc4", "AbC4"));
    }
}