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

Unified Diff: runtime/vm/verified_memory_test.cc

Issue 705713004: Add simpler unit tests for VerifiedMemory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/verified_memory_test.cc
===================================================================
--- runtime/vm/verified_memory_test.cc (revision 41527)
+++ runtime/vm/verified_memory_test.cc (working copy)
@@ -15,6 +15,25 @@
}
+UNIT_TEST_CASE(VerifiedMemoryReserve) {
+ Init();
+ const intptr_t kReservationSize = 64 * KB;
+ VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize);
+ EXPECT_EQ(kReservationSize, vm->size());
+ delete vm;
+}
+
+
+UNIT_TEST_CASE(VerifiedMemoryCommit) {
+ Init();
+ const intptr_t kReservationSize = 64 * KB;
+ VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize);
+ EXPECT_EQ(kReservationSize, vm->size());
+ vm->Commit(false);
+ delete vm;
+}
+
+
UNIT_TEST_CASE(VerifiedMemoryBasic) {
Init();
const intptr_t kReservationSize = 64 * KB;
@@ -33,6 +52,7 @@
int64_t* unverified = reinterpret_cast<int64_t*>(&addr[3]);
*unverified = 123;
VerifiedMemory::Verify(reinterpret_cast<uword>(addr), 3 * sizeof(double));
+ delete vm;
}
@@ -51,6 +71,7 @@
memset(addr, 0xf3, 2 * sizeof(double));
VerifiedMemory::Accept(reinterpret_cast<uword>(addr), 2 * sizeof(double));
VerifiedMemory::Verify(reinterpret_cast<uword>(addr), 3 * sizeof(double));
+ delete vm;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698