feat: add property model foundation

This commit is contained in:
김경종
2026-06-09 11:56:42 +09:00
parent f4196efb10
commit 7ea08441ed
23 changed files with 661 additions and 25 deletions
+37
View File
@@ -0,0 +1,37 @@
#include "fesa/property/Property.hpp"
#include <memory>
namespace {
int require(bool condition) {
return condition ? 0 : 1;
}
class TestProperty final : public fesa::property::Property {
public:
explicit TestProperty(fesa::core::PropertyId id) : id_(id) {}
fesa::core::PropertyId id() const noexcept override {
return id_;
}
fesa::property::PropertyKind kind() const noexcept override {
return fesa::property::PropertyKind::Shell;
}
private:
fesa::core::PropertyId id_;
};
} // namespace
int run_property_base_tests() {
std::unique_ptr<fesa::property::Property> owned = std::make_unique<TestProperty>(500);
const fesa::property::Property& property = *owned;
if (const int result = require(property.id() == 500); result != 0) {
return result;
}
return require(property.kind() == fesa::property::PropertyKind::Shell);
}
+8
View File
@@ -1,4 +1,5 @@
#include "fesa/property/ShellProperty.hpp"
#include "fesa/property/Property.hpp"
#include <stdexcept>
@@ -24,10 +25,17 @@ int require_throws(Function&& function) {
int run_shell_property_tests() {
const fesa::property::ShellProperty property{500, 700, 0.01};
const fesa::property::Property& base = property;
if (const int result = require(property.id() == 500); result != 0) {
return result;
}
if (const int result = require(base.id() == 500); result != 0) {
return result;
}
if (const int result = require(base.kind() == fesa::property::PropertyKind::Shell); result != 0) {
return result;
}
if (const int result = require(property.materialId() == 700); result != 0) {
return result;
}