addstorage_ut.cpp 559 B

123456789101112131415161718192021222324
  1. #include "addstorage.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. class TAddStorageTest: public TTestBase {
  4. UNIT_TEST_SUITE(TAddStorageTest);
  5. UNIT_TEST(TestIt)
  6. UNIT_TEST_SUITE_END();
  7. class TClass: public TAdditionalStorage<TClass> {
  8. };
  9. private:
  10. inline void TestIt() {
  11. THolder<TClass> c(new (100) TClass);
  12. UNIT_ASSERT_EQUAL(c->AdditionalDataLength(), 100);
  13. //test segfault
  14. memset(c->AdditionalData(), 0, c->AdditionalDataLength());
  15. }
  16. };
  17. UNIT_TEST_SUITE_REGISTRATION(TAddStorageTest);