aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/lower_case/lchash_ut.cpp
blob: 4df3b80e1729aeb72a2cf9533ac2658da5b2d289 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "lchash.h"

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

Y_UNIT_TEST_SUITE(TWebDaemonHash) {
    Y_UNIT_TEST(Stability) {
        UNIT_ASSERT_VALUES_EQUAL(FnvCaseLess<ui64>("blah"), ULL(5923727754379976229));
        UNIT_ASSERT_VALUES_EQUAL(FnvCaseLess<ui64>("blahminor"), ULL(8755704309003440816));
    }

    Y_UNIT_TEST(CaseLess) {
        UNIT_ASSERT_VALUES_EQUAL(FnvCaseLess<ui64>("blah"), FnvCaseLess<ui64>("bLah"));
        UNIT_ASSERT_VALUES_EQUAL(FnvCaseLess<ui64>("blah"), FnvCaseLess<ui64>("blAh"));
        UNIT_ASSERT_VALUES_EQUAL(FnvCaseLess<ui64>("blah"), FnvCaseLess<ui64>("BLAH"));
    }

    Y_UNIT_TEST(Robustness) {
        UNIT_ASSERT(FnvCaseLess<ui64>("x-real-ip") != FnvCaseLess<ui64>("x-req-id"));
        UNIT_ASSERT(FnvCaseLess<ui64>("x-real-ip") != FnvCaseLess<ui64>("x-start-time"));
    }
}