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

Unified Diff: runtime/vm/atomic_test.cc

Issue 2344193002: Make NoReloadScope thread safe (Closed)
Patch Set: Implement atomic operations for intptr_t Created 4 years, 3 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_macos.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 6973d8b42a03c14a8ead95c8ca2e7e1935166d9e..782f4f308fe43445454ddb932e8cfd654de2029b 100644
--- a/runtime/vm/atomic_test.cc
+++ b/runtime/vm/atomic_test.cc
@@ -26,6 +26,22 @@ UNIT_TEST_CASE(FetchAndDecrement) {
}
+UNIT_TEST_CASE(FetchAndIncrementSigned) {
+ intptr_t v = -42;
+ EXPECT_EQ(static_cast<uintptr_t>(-42),
Florian Schneider 2016/09/16 18:01:36 intptr_t
Cutch 2016/09/16 18:07:51 Done here and elsewhere.
+ AtomicOperations::FetchAndIncrement(&v));
+ EXPECT_EQ(static_cast<uintptr_t>(-41), v);
Florian Schneider 2016/09/16 18:01:36 intptr_t? Or remove these static_casts. They seem
+}
+
+
+UNIT_TEST_CASE(FetchAndDecrementSigned) {
+ intptr_t v = -42;
+ EXPECT_EQ(static_cast<uintptr_t>(-42),
Florian Schneider 2016/09/16 18:01:36 Same as above.
+ AtomicOperations::FetchAndDecrement(&v));
+ EXPECT_EQ(static_cast<uintptr_t>(-43), v);
Florian Schneider 2016/09/16 18:01:36 Same as above.
+}
+
+
UNIT_TEST_CASE(IncrementBy) {
intptr_t v = 42;
AtomicOperations::IncrementBy(&v, 100);
« no previous file with comments | « runtime/vm/atomic_macos.h ('k') | runtime/vm/atomic_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698