util: MemoryMap test failure more verbose
Change-Id: Ie42e1983d8cc5658b7e88d59cdbe689e6aefe9f2
This commit is contained in:
@ -99,6 +99,8 @@ public:
|
|||||||
* address2<tab>size2
|
* address2<tab>size2
|
||||||
* ...
|
* ...
|
||||||
* \endcode
|
* \endcode
|
||||||
|
*
|
||||||
|
* @return false if file could not be read
|
||||||
*/
|
*/
|
||||||
bool readFromFile(char const * const filename);
|
bool readFromFile(char const * const filename);
|
||||||
/**
|
/**
|
||||||
@ -106,6 +108,8 @@ public:
|
|||||||
*
|
*
|
||||||
* Currently all access size information is lost; the map is flattened out
|
* Currently all access size information is lost; the map is flattened out
|
||||||
* to a long list of single-byte addresses.
|
* to a long list of single-byte addresses.
|
||||||
|
*
|
||||||
|
* @return false if file could not be written
|
||||||
*/
|
*/
|
||||||
bool writeToFile(char const * const filename);
|
bool writeToFile(char const * const filename);
|
||||||
|
|
||||||
|
|||||||
@ -109,27 +109,39 @@ int main()
|
|||||||
|
|
||||||
test(mm);
|
test(mm);
|
||||||
|
|
||||||
mm.writeToFile(filename_tmp);
|
if (!mm.writeToFile(filename_tmp)) {
|
||||||
|
test_failed("writing tmp file");
|
||||||
|
}
|
||||||
mm.clear();
|
mm.clear();
|
||||||
mm.readFromFile(filename_tmp);
|
if (!mm.readFromFile(filename_tmp)) {
|
||||||
|
test_failed("reading tmp file");
|
||||||
|
}
|
||||||
|
|
||||||
mm.dump(cerr);
|
mm.dump(cerr);
|
||||||
|
|
||||||
test(mm);
|
test(mm);
|
||||||
|
|
||||||
// intentionally omitting mm.clear() here
|
// intentionally omitting mm.clear() here
|
||||||
mm.readFromFile(filename_test1);
|
if (!mm.readFromFile(filename_test1)) {
|
||||||
|
test_failed(filename_test1);
|
||||||
|
}
|
||||||
test(mm);
|
test(mm);
|
||||||
|
|
||||||
mm.clear();
|
mm.clear();
|
||||||
mm.readFromFile(filename_test1);
|
if (!mm.readFromFile(filename_test1)) {
|
||||||
|
test_failed(filename_test1);
|
||||||
|
}
|
||||||
test(mm);
|
test(mm);
|
||||||
|
|
||||||
mm.clear();
|
mm.clear();
|
||||||
mm.readFromFile(filename_test2);
|
if (!mm.readFromFile(filename_test2)) {
|
||||||
|
test_failed(filename_test2);
|
||||||
|
}
|
||||||
test(mm);
|
test(mm);
|
||||||
|
|
||||||
mm.clear();
|
mm.clear();
|
||||||
mm.readFromFile(filename_test3);
|
if (!mm.readFromFile(filename_test3)) {
|
||||||
|
test_failed(filename_test3);
|
||||||
|
}
|
||||||
test(mm);
|
test(mm);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user