summaryrefslogtreecommitdiffstats
path: root/test/utest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/utest.cpp')
-rwxr-xr-xtest/utest.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/test/utest.cpp b/test/utest.cpp
index f777742..ac0aa7c 100755
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -11,28 +11,26 @@
using namespace phosphor::software::manager;
namespace fs = std::experimental::filesystem;
-
class VersionTest : public testing::Test
{
- protected:
+ protected:
+ virtual void SetUp()
+ {
+ char versionDir[] = "./versionXXXXXX";
+ _directory = mkdtemp(versionDir);
- virtual void SetUp()
+ if (_directory.empty())
{
- char versionDir[] = "./versionXXXXXX";
- _directory = mkdtemp(versionDir);
-
- if (_directory.empty())
- {
- throw std::bad_alloc();
- }
+ throw std::bad_alloc();
}
+ }
- virtual void TearDown()
- {
- fs::remove_all(_directory);
- }
+ virtual void TearDown()
+ {
+ fs::remove_all(_directory);
+ }
- std::string _directory;
+ std::string _directory;
};
/** @brief Make sure we correctly get the version and purpose from getValue()*/
@@ -63,10 +61,10 @@ TEST_F(VersionTest, TestGetId)
SHA512_Init(&ctx);
SHA512_Update(&ctx, version, strlen(version));
SHA512_Final(digest, &ctx);
- char mdString[SHA512_DIGEST_LENGTH*2+1];
+ char mdString[SHA512_DIGEST_LENGTH * 2 + 1];
for (int i = 0; i < SHA512_DIGEST_LENGTH; i++)
{
- snprintf(&mdString[i*2], 3, "%02x", (unsigned int)digest[i]);
+ snprintf(&mdString[i * 2], 3, "%02x", (unsigned int)digest[i]);
}
std::string hexId = std::string(mdString);
hexId = hexId.substr(0, 8);
OpenPOWER on IntegriCloud