Cleanup unit tests that export files by making sure those files are deleted once the unit test is complete. Moved logging from a .txt to a .log file so that git ignores the files (#5852)
Signed-off-by: AMZN-Gene <genewalt@amazon.com> Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
co-authored by
Kim Kulling
parent
287d7ec213
commit
ec563823b6
@@ -57,18 +57,29 @@ public:
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure);
|
||||
|
||||
Exporter exporter;
|
||||
aiReturn res = exporter.Export(scene, "assjson", "./spider_test.json");
|
||||
const char *testFileName = "./spider_test.json";
|
||||
aiReturn res = exporter.Export(scene, "assjson", testFileName);
|
||||
if (aiReturn_SUCCESS != res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Assimp::ExportProperties exportProperties;
|
||||
exportProperties.SetPropertyBool("JSON_SKIP_WHITESPACES", true);
|
||||
aiReturn resNoWhitespace = exporter.Export(scene, "assjson", "./spider_test_nowhitespace.json", 0u, &exportProperties);
|
||||
const char *testNoWhitespaceFileName = "./spider_test_nowhitespace.json";
|
||||
aiReturn resNoWhitespace = exporter.Export(scene, "assjson", testNoWhitespaceFileName, 0u, &exportProperties);
|
||||
if (aiReturn_SUCCESS != resNoWhitespace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cleanup, remove generated json
|
||||
if (0 != std::remove(testFileName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 != std::remove(testNoWhitespaceFileName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user