Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: runtime/vm/atomic_test.cc

Issue 1562253002: Add a CompareAndSwapUint32 variant to AtomicOperations so that it is possible to a CAS of a 32 bit … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/atomic_simulator.h ('k') | runtime/vm/atomic_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/atomic_test.cc
diff --git a/runtime/vm/atomic_test.cc b/runtime/vm/atomic_test.cc
index 5e22606047e83c6b6bb253fce715d332352ccabd..e7e366641f92332e5fdba0e282614a75af891ece 100644
--- a/runtime/vm/atomic_test.cc
+++ b/runtime/vm/atomic_test.cc
@@ -31,4 +31,22 @@ UNIT_TEST_CASE(LoadRelaxed) {
EXPECT_EQ(static_cast<uword>(42), AtomicOperations::LoadRelaxed(&v));
}
+
+UNIT_TEST_CASE(CompareAndSwapWord) {
+ uword old_value = 42;
+ uword new_value = 100;
+ uword result = AtomicOperations::CompareAndSwapWord(
+ &old_value, old_value, new_value);
+ EXPECT_EQ(static_cast<uword>(42), result);
+}
+
+
+UNIT_TEST_CASE(CompareAndSwapUint32) {
+ uint32_t old_value = 42;
+ uint32_t new_value = 100;
+ uint32_t result = AtomicOperations::CompareAndSwapUint32(
+ &old_value, old_value, new_value);
+ EXPECT_EQ(static_cast<uint32_t>(42), result);
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/atomic_simulator.h ('k') | runtime/vm/atomic_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698