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

Unified Diff: debugger/rsp/rsp_blob_utils_test.cc

Issue 7466014: Add rsp::GetOffsets command + reply (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src/
Patch Set: '' Created 9 years, 5 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 | « debugger/rsp/rsp_blob_utils.h ('k') | debugger/rsp/rsp_info_packets.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/rsp/rsp_blob_utils_test.cc
===================================================================
--- debugger/rsp/rsp_blob_utils_test.cc (revision 931)
+++ debugger/rsp/rsp_blob_utils_test.cc (working copy)
@@ -14,6 +14,8 @@
debug::Blob blob_;
};
+#define EXPECT_BLOBEQ(x, y) EXPECT_STREQ(x, y.ToString().c_str()); y.Clear()
+
// Unit tests start here.
TEST_F(BlobUtilsTest, PopInt8FromFront) {
LoadBlob("10abcd");
@@ -119,8 +121,44 @@
EXPECT_STREQ("[12345]", blob_.ToString().c_str());
rsp::Format(&blob_, "[%d-%x]", 12345, 0x1234);
- EXPECT_STREQ("[12345-1234]", blob_.ToString().c_str());
+ EXPECT_BLOBEQ("[12345-1234]", blob_);
}
+TEST_F(BlobUtilsTest, PushIntToBack) {
+ uint32_t x = 0;
+ debug::Blob blob;
+ EXPECT_BLOBEQ("0", rsp::PushIntToBack(x, &blob));
+
+ x = 0x21;
+ EXPECT_BLOBEQ("21", rsp::PushIntToBack(x, &blob));
+
+ x = 0x1234;
+ EXPECT_BLOBEQ("1234", rsp::PushIntToBack(x, &blob));
+
+ x = 0x0234;
+ EXPECT_BLOBEQ("234", rsp::PushIntToBack(x, &blob));
+
+ uint64_t y = 0;
+ EXPECT_BLOBEQ("0", rsp::PushIntToBack(y, &blob));
+
+ y = 0x21;
+ EXPECT_BLOBEQ("21", rsp::PushIntToBack(y, &blob));
+
+ y = 0x1234;
+ EXPECT_BLOBEQ("1234", rsp::PushIntToBack(y, &blob));
+
+ y = 0x0234;
+ EXPECT_BLOBEQ("234", rsp::PushIntToBack(y, &blob));
+
+ y = 0x1234567890abcdef;
+ EXPECT_BLOBEQ("1234567890abcdef", rsp::PushIntToBack(y, &blob));
+
+ y = 0x234567890abcdef;
+ EXPECT_BLOBEQ("234567890abcdef", rsp::PushIntToBack(y, &blob));
+
+ y = 0x34567890abcdef;
+ EXPECT_BLOBEQ("34567890abcdef", rsp::PushIntToBack(y, &blob));
+}
+
} // namespace
« no previous file with comments | « debugger/rsp/rsp_blob_utils.h ('k') | debugger/rsp/rsp_info_packets.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698