aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory/addstorage_ut.cpp
blob: 15530159223240abe4602fb9bbab7c2aef9cb234 (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);