aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory/addstorage_ut.cpp
blob: 9b0c4989ab6fd0dc40ac83dd980e8113064136bd (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
#include "addstorage.h"

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

class TAddStorageTest: public TTestBase {
    UNIT_TEST_SUITE(TAddStorageTest);
    UNIT_TEST(TestIt)
    UNIT_TEST_SUITE_END();

    class TClass: public TAdditionalStorage<TClass> {
    };

private:
    inline void TestIt() {
        THolder<TClass> c(new (100) TClass);

        UNIT_ASSERT_EQUAL(c->AdditionalDataLength(), 100);

        //test segfault
        memset(c->AdditionalData(), 0, c->AdditionalDataLength());
    }
};

UNIT_TEST_SUITE_REGISTRATION(TAddStorageTest);