From 1110808a9d39d4b808aef724c861a2e1a38d2a69 Mon Sep 17 00:00:00 2001 From: Devtools Arcadia <arcadia-devtools@yandex-team.ru> Date: Mon, 7 Feb 2022 18:08:42 +0300 Subject: intermediate changes ref:cde9a383711a11544ce7e107a78147fb96cc4029 --- library/cpp/threading/atomic/bool_ut.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 library/cpp/threading/atomic/bool_ut.cpp (limited to 'library/cpp/threading/atomic/bool_ut.cpp') diff --git a/library/cpp/threading/atomic/bool_ut.cpp b/library/cpp/threading/atomic/bool_ut.cpp new file mode 100644 index 0000000000..9481f41d8d --- /dev/null +++ b/library/cpp/threading/atomic/bool_ut.cpp @@ -0,0 +1,31 @@ +#include "bool.h" + +#include <library/cpp/testing/unittest/registar.h> + +Y_UNIT_TEST_SUITE(AtomicBool) { + Y_UNIT_TEST(ReadWrite) { + NAtomic::TBool v; + + UNIT_ASSERT_VALUES_EQUAL((bool)v, false); + + v = true; + + UNIT_ASSERT_VALUES_EQUAL((bool)v, true); + + v = false; + + UNIT_ASSERT_VALUES_EQUAL((bool)v, false); + + NAtomic::TBool v2; + + UNIT_ASSERT(v == v2); + + v2 = true; + + UNIT_ASSERT(v != v2); + + v = v2; + + UNIT_ASSERT(v == v2); + } +} -- cgit v1.2.3