79e43b093a
* **New Features** * Added public accessors for querying module/device start and ready state. * **Refactor** * Internal state moved to opaque internal objects; module/device/driver initializers now explicitly initialize internal pointers. * Lifecycle handling updated to construct/destruct internal state and use accessors. * **Tests** * Tests updated to use public accessors and explicit construct/destruct lifecycle calls. * **Chores** * Test build/include paths and small metadata updated.
31 lines
985 B
C++
31 lines
985 B
C++
#include "../../TactilityCore/Source/TestFile.h"
|
|
#include "../../Tactility/Include/Tactility/file/PropertiesFile.h"
|
|
|
|
#include "doctest.h"
|
|
|
|
using namespace tt;
|
|
|
|
TEST_CASE("loadPropertiesFile() should return false when the file does not exist") {
|
|
std::map<std::string, std::string> properties;
|
|
CHECK_EQ(file::loadPropertiesFile("does_not_exist.properties", properties), false);
|
|
}
|
|
|
|
TEST_CASE("PropertiesFile should parse a valid file properly") {
|
|
TestFile file("test.properties");
|
|
file.writeData(
|
|
"# Comment\n" // Regular comment
|
|
" \t# Comment\n" // Prefixed comment
|
|
"key1=value1\n" // Regular property
|
|
" \tkey 2\t = \tvalue 2\t " // Property with empty space
|
|
);
|
|
|
|
std::map<std::string, std::string> properties;
|
|
|
|
// Load data
|
|
CHECK_EQ(file::loadPropertiesFile(file.getPath(), properties), true);
|
|
|
|
CHECK_EQ(properties.size(), 2);
|
|
CHECK_EQ(properties["key1"], "value1");
|
|
CHECK_EQ(properties["key 2"], "value 2");
|
|
}
|