| OLD | NEW |
| 1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Module::Function *function = new Module::Function(name, DUP_ADDRESS); | 57 Module::Function *function = new Module::Function(name, DUP_ADDRESS); |
| 58 function->size = DUP_SIZE; | 58 function->size = DUP_SIZE; |
| 59 function->parameter_size = DUP_PARAMETER_SIZE; | 59 function->parameter_size = DUP_PARAMETER_SIZE; |
| 60 return function; | 60 return function; |
| 61 } | 61 } |
| 62 | 62 |
| 63 #define MODULE_NAME "name with spaces" | 63 #define MODULE_NAME "name with spaces" |
| 64 #define MODULE_OS "os-name" | 64 #define MODULE_OS "os-name" |
| 65 #define MODULE_ARCH "architecture" | 65 #define MODULE_ARCH "architecture" |
| 66 #define MODULE_ID "id-string" | 66 #define MODULE_ID "id-string" |
| 67 #define MODULE_CODE_ID "code-id-string" |
| 67 | 68 |
| 68 TEST(Write, Header) { | 69 TEST(Write, Header) { |
| 69 stringstream s; | 70 stringstream s; |
| 70 Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID); | 71 Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID); |
| 71 m.Write(s, ALL_SYMBOL_DATA); | 72 m.Write(s, ALL_SYMBOL_DATA); |
| 72 string contents = s.str(); | 73 string contents = s.str(); |
| 73 EXPECT_STREQ("MODULE os-name architecture id-string name with spaces\n", | 74 EXPECT_STREQ("MODULE os-name architecture id-string name with spaces\n", |
| 74 contents.c_str()); | 75 contents.c_str()); |
| 75 } | 76 } |
| 76 | 77 |
| 78 TEST(Write, HeaderCodeId) { |
| 79 stringstream s; |
| 80 Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID, MODULE_CODE_ID); |
| 81 m.Write(s, ALL_SYMBOL_DATA); |
| 82 string contents = s.str(); |
| 83 EXPECT_STREQ("MODULE os-name architecture id-string name with spaces\n" |
| 84 "INFO CODE_ID code-id-string\n", |
| 85 contents.c_str()); |
| 86 } |
| 87 |
| 77 TEST(Write, OneLineFunc) { | 88 TEST(Write, OneLineFunc) { |
| 78 stringstream s; | 89 stringstream s; |
| 79 Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID); | 90 Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID); |
| 80 | 91 |
| 81 Module::File *file = m.FindFile("file_name.cc"); | 92 Module::File *file = m.FindFile("file_name.cc"); |
| 82 Module::Function *function = new Module::Function( | 93 Module::Function *function = new Module::Function( |
| 83 "function_name", 0xe165bf8023b9d9abLL); | 94 "function_name", 0xe165bf8023b9d9abLL); |
| 84 function->size = 0x1e4bb0eb1cbf5b09LL; | 95 function->size = 0x1e4bb0eb1cbf5b09LL; |
| 85 function->parameter_size = 0x772beee89114358aLL; | 96 function->parameter_size = 0x772beee89114358aLL; |
| 86 Module::Line line = { 0xe165bf8023b9d9abLL, 0x1e4bb0eb1cbf5b09LL, | 97 Module::Line line = { 0xe165bf8023b9d9abLL, 0x1e4bb0eb1cbf5b09LL, |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 m.Write(s, ALL_SYMBOL_DATA); | 548 m.Write(s, ALL_SYMBOL_DATA); |
| 538 string contents = s.str(); | 549 string contents = s.str(); |
| 539 | 550 |
| 540 EXPECT_STREQ("MODULE " MODULE_OS " arm " | 551 EXPECT_STREQ("MODULE " MODULE_OS " arm " |
| 541 MODULE_ID " " MODULE_NAME "\n" | 552 MODULE_ID " " MODULE_NAME "\n" |
| 542 "FUNC fff0 10 0 _thumb_xyz\n" | 553 "FUNC fff0 10 0 _thumb_xyz\n" |
| 543 "PUBLIC abc1 0 thumb_abc\n" | 554 "PUBLIC abc1 0 thumb_abc\n" |
| 544 "PUBLIC cc00 0 arm_func\n", | 555 "PUBLIC cc00 0 arm_func\n", |
| 545 contents.c_str()); | 556 contents.c_str()); |
| 546 } | 557 } |
| OLD | NEW |