Files
compute-runtime/unit_tests/os_interface/windows/registry_reader_tests.cpp
Filip Hazubski 8b57d28116 clang-format: enable sorting includes
Include files are now grouped and sorted in following order:
1. Header file of the class the current file implements
2. Project files
3. Third party files
4. Standard library

Change-Id: If31af05652184169f7fee1d7ad08f1b2ed602cf0
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-02-27 11:50:07 +01:00

50 lines
1.7 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/os_interface/windows/registry_reader_tests.h"
#include "test.h"
using namespace OCLRT;
using RegistryReaderTest = ::testing::Test;
TEST_F(RegistryReaderTest, givenRegistryReaderWhenItIsCreatedWithUserScopeSetToFalseThenItsHkeyTypeIsInitializedToHkeyLocalMachine) {
bool userScope = false;
TestedRegistryReader registryReader(userScope);
EXPECT_EQ(HKEY_LOCAL_MACHINE, registryReader.getHkeyType());
}
TEST_F(RegistryReaderTest, givenRegistryReaderWhenItIsCreatedWithUserScopeSetToTrueThenItsHkeyTypeIsInitializedHkeyCurrentUser) {
bool userScope = true;
TestedRegistryReader registryReader(userScope);
EXPECT_EQ(HKEY_CURRENT_USER, registryReader.getHkeyType());
}
TEST_F(RegistryReaderTest, givenRegistryReaderWhenCallAppSpecificLocationThenReturnCurrentProcessName) {
char buff[MAX_PATH];
GetModuleFileNameA(nullptr, buff, MAX_PATH);
TestedRegistryReader registryReader(false);
const char *ret = registryReader.appSpecificLocation("cl_cache_dir");
EXPECT_STREQ(buff, ret);
}
TEST_F(RegistryReaderTest, givenRegistryReaderWhenRegKeyNotExistThenReturnDefaultValue) {
std::string regKey = "notExistPath";
std::string value = "defaultValue";
TestedRegistryReader registryReader(regKey);
EXPECT_EQ(value, registryReader.getSetting("", value));
}
TEST_F(RegistryReaderTest, givenRegistryReaderWhenItIsCreatedWithRegKeySpecifiedThenRegKeyIsInitializedAccordingly) {
std::string regKey = "Software\\Intel\\IGFX\\OCL\\regKey";
TestedRegistryReader registryReader(regKey);
EXPECT_STREQ(regKey.c_str(), registryReader.getRegKey());
}