SORRY. It seems I've screwed up my commit for http://breakpad.appspot.com/411002/, since revision 1001 only contains the new src/client/linux/linux_libc_support.cc and none of the other required files.

I'm not sure what happened, but I'm re-uploading the patch has another issue.

Review URL: https://breakpad.appspot.com/426002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1002 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
digit@chromium.org 2012-08-03 15:01:52 +00:00
parent 7475fb4bb4
commit e0555f5bdf
10 changed files with 256 additions and 255 deletions

View file

@ -129,6 +129,23 @@ TEST(LinuxLibcSupportTest, strchr) {
ASSERT_TRUE(my_strchr("abc", 'a'));
ASSERT_TRUE(my_strchr("bcda", 'a'));
ASSERT_TRUE(my_strchr("sdfasdf", 'a'));
static const char abc3[] = "abcabcabc";
ASSERT_EQ(abc3, my_strchr(abc3, 'a'));
}
TEST(LinuxLibcSupportTest, strrchr) {
ASSERT_EQ(NULL, my_strrchr("abc", 'd'));
ASSERT_EQ(NULL, my_strrchr("", 'd'));
ASSERT_EQ(NULL, my_strrchr("efghi", 'd'));
ASSERT_TRUE(my_strrchr("a", 'a'));
ASSERT_TRUE(my_strrchr("abc", 'a'));
ASSERT_TRUE(my_strrchr("bcda", 'a'));
ASSERT_TRUE(my_strrchr("sdfasdf", 'a'));
static const char abc3[] = "abcabcabc";
ASSERT_EQ(abc3 + 6, my_strrchr(abc3, 'a'));
}
TEST(LinuxLibcSupportTest, read_hex_ptr) {
@ -155,3 +172,24 @@ TEST(LinuxLibcSupportTest, read_hex_ptr) {
ASSERT_EQ(result, 0x123a);
ASSERT_EQ(*last, '-');
}
TEST(LinuxLibcSupportTest, read_decimal_ptr) {
uintptr_t result;
const char* last;
last = my_read_decimal_ptr(&result, "0");
ASSERT_EQ(result, 0);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "0123");
ASSERT_EQ(result, 123);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "1234");
ASSERT_EQ(result, 1234);
ASSERT_EQ(*last, 0);
last = my_read_decimal_ptr(&result, "01234-");
ASSERT_EQ(result, 1234);
ASSERT_EQ(*last, '-');
}