Files
tactility/Tests/Tactility/Source/PropertiesFileTest.cpp
Ken Van Hoeylandt 79e43b093a Kernel improvements (#485)
* **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.
2026-02-06 16:32:30 +01:00

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");
}