singleton_ut.cpp 422 B

123456789101112131415161718192021
  1. #include <library/cpp/testing/unittest/registar.h>
  2. #include "singleton.h"
  3. namespace {
  4. struct TFoo {
  5. int i;
  6. TFoo()
  7. : i(0)
  8. {
  9. }
  10. };
  11. }
  12. Y_UNIT_TEST_SUITE(Tls) {
  13. Y_UNIT_TEST(FastThread) {
  14. UNIT_ASSERT_VALUES_EQUAL(0, FastTlsSingleton<TFoo>()->i);
  15. FastTlsSingleton<TFoo>()->i += 3;
  16. UNIT_ASSERT_VALUES_EQUAL(3, FastTlsSingleton<TFoo>()->i);
  17. }
  18. }