bool_ut.cpp 515 B

12345678910111213141516171819202122232425262728293031
  1. #include "bool.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. Y_UNIT_TEST_SUITE(AtomicBool) {
  4. Y_UNIT_TEST(ReadWrite) {
  5. NAtomic::TBool v;
  6. UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
  7. v = true;
  8. UNIT_ASSERT_VALUES_EQUAL((bool)v, true);
  9. v = false;
  10. UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
  11. NAtomic::TBool v2;
  12. UNIT_ASSERT(v == v2);
  13. v2 = true;
  14. UNIT_ASSERT(v != v2);
  15. v = v2;
  16. UNIT_ASSERT(v == v2);
  17. }
  18. }