diff --git a/.github/workflows/reviewdog-cpplint.yml b/.github/workflows/reviewdog-cpplint.yml index 6e01f6cbc..a246d2467 100644 --- a/.github/workflows/reviewdog-cpplint.yml +++ b/.github/workflows/reviewdog-cpplint.yml @@ -16,19 +16,20 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review flags: --linelength=150 - filter: "-build/include_alpha\ - ,-build/include_what_you_use\ - ,-build/storage_class\ - ,-readability/braces\ - ,-readability/casting\ - ,-readability/fn_size\ - ,-whitespace/braces\ - ,-whitespace/comma\ - ,-whitespace/comments\ - ,-whitespace/end_of_line\ - ,-whitespace/ending_newline\ - ,-whitespace/indent\ - ,-whitespace/newline\ - ,-whitespace/operators\ - ,-whitespace/parens\ + filter: "build/include_alpha\ + ,build/include_what_you_use\ + ,build/storage_class\ + ,readability/braces\ + ,readability/casting\ + ,readability/fn_size\ + ,whitespace/braces\ + ,whitespace/comma\ + ,whitespace/comments\ + ,whitespace/end_of_line\ + ,whitespace/ending_newline\ + ,whitespace/indent\ + ,whitespace/newline\ + ,whitespace/operators\ + ,whitespace/parens\ + ,whitespace/line_length\ " diff --git a/Library/PAX_SAPIENTICA/Simulation/Agent.hpp b/Library/PAX_SAPIENTICA/Simulation/Agent.hpp index cba93d058..0f7618c07 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Agent.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Agent.hpp @@ -36,8 +36,9 @@ namespace paxs { using Vector2 = paxs::Vector2; using Environment = paxs::Environment; - constexpr explicit Agent(const std::string& id, const std::string& name, const Vector2& pos, const std::uint_least8_t gen, const std::uint_least32_t age, const std::uint_least32_t life_span, const std::shared_ptr env) noexcept - : Object(id, name, pos), gender(gen), age(age), life_span(life_span), environment(env) {} + constexpr explicit Agent(const std::uint_least32_t id, const std::string& name, const Vector2& pos, const std::uint_least8_t gen, + const std::uint_least32_t age, const std::uint_least32_t life_span, const std::shared_ptr env) noexcept + : Object(id, name, pos), gender(gen), age(age), life_span(life_span), environment(env) {} /// @brief Move the agent. /// @brief エージェントを移動させる diff --git a/Library/PAX_SAPIENTICA/Simulation/BaseGroup.hpp b/Library/PAX_SAPIENTICA/Simulation/BaseGroup.hpp new file mode 100644 index 000000000..9cd998eaf --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/BaseGroup.hpp @@ -0,0 +1,66 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_BASE_GROUP_HPP +#define PAX_SAPIENTICA_BASE_GROUP_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include + +#include +#include + +namespace paxs { + + template + class BaseGroup { + public: + using Vector2 = paxs::Vector2; + using Object = paxs::Object; + using Agent = paxs::Agent; + + constexpr explicit BaseGroup(const std::uint_least32_t id) noexcept : id(id) {} + + /// @brief Get the uuid. + /// @brief idを取得 + constexpr std::uint_least32_t getId() const noexcept { return id; } + + /// @brief Add an agent to the settlement. + /// @brief 集落にエージェントを追加 + virtual void addAgent(const Agent& agent) { agents.push_back(agent); } + + /// @brief Get the agent. + /// @brief エージェントを取得 + /// @param id The agent's id. エージェントのID + constexpr Agent getAgent(const std::string& id) const { + for (const auto& agent : agents) { + if (agent.getID() == id) { + return agent; + } + } + throw std::runtime_error("Agent not found."); + } + + protected: + /// @brief エージェントの配列 + std::vector agents; + + private: + /// @brief 集落id + std::uint_least32_t id; + }; + +} + +#endif // !PAX_SAPIENTICA_BASE_GROUP_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/BasicGroup.hpp b/Library/PAX_SAPIENTICA/Simulation/BasicGroup.hpp new file mode 100644 index 000000000..5d04c4094 --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/BasicGroup.hpp @@ -0,0 +1,52 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_BASIC_GROUP_HPP +#define PAX_SAPIENTICA_BASIC_GROUP_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include + +#include + +namespace paxs { + + /// @brief A class that represents a basic group. + /// @brief 基礎集団を表すクラス + template + class BasicGroup : public BaseGroup + { + public: + using Agent = paxs::Agent; + using Vector2 = paxs::Vector2; + + constexpr explicit BasicGroup(const std::string& id, const std::vector& positions) noexcept + : BaseGroup(id), positions(positions) {} + + void addAgent(const Agent& agent) override { + if (this->agents.size() + 1 < basic_group_max) { + this->agents.push_back(agent); + } else { + throw std::runtime_error("The number of agents in the basic group has reached the limit."); + } + } + private: + /// @brief 基礎集団の位置 + std::vector positions; + + }; + +} + +#endif // !PAX_SAPIENTICA_BASIC_GROUP_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/CompositeSettlement.hpp b/Library/PAX_SAPIENTICA/Simulation/CompositeSettlement.hpp new file mode 100644 index 000000000..7ea0068b2 --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/CompositeSettlement.hpp @@ -0,0 +1,42 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_COMPOSITE_SETTLEMENT_HPP +#define PAX_SAPIENTICA_COMPOSITE_SETTLEMENT_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include + +namespace paxs { + + /// @brief A class that represents a composite settlement. + /// @brief 複合集落を表すクラス + template + class CompositeSettlement : public BaseGroup { + public: + using Vector2 = paxs::Vector2; + using Object = paxs::Object; + using Agent = paxs::Agent; + + constexpr explicit CompositeSettlement(const std::uint_least32_t id) noexcept : BaseGroup(id) {} + + private: + /// @brief 基礎集団の位置 + std::vector positions; + + }; + +} + +#endif // !PAX_SAPIENTICA_COMPOSITE_SETTLEMENT_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/GroupSimulator.hpp b/Library/PAX_SAPIENTICA/Simulation/GroupSimulator.hpp new file mode 100644 index 000000000..9d00f011c --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/GroupSimulator.hpp @@ -0,0 +1,60 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_GROUP_SIMULATOR_HPP +#define PAX_SAPIENTICA_GROUP_SIMULATOR_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include +#include +#include + +namespace paxs { + + template + class GroupSimulator + { + public: + using Vector2 = paxs::Vector2; + using Environment = paxs::Environment; + using Agent = paxs::Agent; + + constexpr explicit GroupSimulator() = default; + explicit GroupSimulator(const std::string& setting_file_path, + const Vector2& start_position, const Vector2& end_position, const int z, const unsigned seed = 0) + : environment(std::make_unique(setting_file_path, start_position, end_position, z)), gen(seed) { + if (z <= 0) { + Logger logger("Save/error_log.txt"); + const std::string message = "Z must be greater than 0."; + logger.log(Logger::Level::ERROR, __FILE__, __LINE__, message); + throw std::runtime_error(message); + } + if (start_position.x < 0 || start_position.y < 0 || end_position.x < 0 || end_position.y < 0) { + Logger logger("Save/error_log.txt"); + const std::string message = "Start position and end position must be greater than or equal to 0."; + logger.log(Logger::Level::ERROR, __FILE__, __LINE__, message); + throw std::runtime_error(message); + } + } + + private: + std::vector> groups; // グループ + std::shared_ptr environment; // 環境 + std::mt19937 gen; // 乱数生成器 + + }; + +} + +#endif // !PAX_SAPIENTICA_GROUP_SIMULATOR_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/Object.hpp b/Library/PAX_SAPIENTICA/Simulation/Object.hpp index cbb907c9d..d4434bc89 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Object.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Object.hpp @@ -28,10 +28,11 @@ namespace paxs { public: using Vector2 = paxs::Vector2; - constexpr explicit Object(const std::string& id, const std::string& name, const Vector2& position) noexcept : id(id), name(name), position(position) {} + constexpr explicit Object(const std::uint_least32_t id, const std::string& name, const Vector2& position) noexcept + : id(id), name(name), position(position) {} /// @brief Get the object's id. オブジェクトのIDを取得 - std::string getId() const noexcept { return id; } + std::uint_least32_t getId() const noexcept { return id; } /// @brief Get the coordinate x. オブジェクトの座標xを取得 constexpr GridType getX() const noexcept { return position.x; } @@ -62,7 +63,7 @@ namespace paxs { } protected: - std::string id; // オブジェクトのID + std::uint_least32_t id; // オブジェクトのID std::string name; // オブジェクトの名前 Vector2 position; // オブジェクトの座標 }; diff --git a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp new file mode 100644 index 000000000..b5897176e --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp @@ -0,0 +1,135 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_SETTLEMENT_HPP +#define PAX_SAPIENTICA_SETTLEMENT_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include +#include + +#include +#include +#include + +namespace paxs { + + template + class Settlement { + public: + using Vector2 = paxs::Vector2; + using Object = paxs::Object; + using Agent = paxs::Agent; + + constexpr explicit Settlement(const std::uint_least32_t id) noexcept : id(id) {} + + /// @brief Get the uuid. + /// @brief idを取得 + constexpr std::uint_least32_t getId() const noexcept { return id; } + + /// @brief Add an agent to the settlement. + /// @brief 集落にエージェントを追加 + void addAgent(const Agent& agent) noexcept { agents.push_back(agent); } + + /// @brief Set the position of the settlement. + /// @brief 集落の座標を設定 + void setPosition(const Vector2& position) noexcept { positions.push_back(position); } + + /// @brief Get the agent. + /// @brief エージェントを取得 + /// @param id The agent's id. エージェントのID + Agent& getAgent(const std::uint_least32_t id) const { + auto it = std::find_if(agents.begin(), agents.end(), [id](const Agent& agent) { return agent.getId() == id; }); + if (it == agents.end()) { + paxs::Logger logger("Save/error_log.txt"); + const std::string message = "Agent not found."; + logger.log(Logger::Level::WARNING, __FILE__, __LINE__, message); + throw std::runtime_error(message); + } + return *it; + } + + /// @brief Pre update. + /// @brief 事前更新 + void preUpdate(std::mt19937& engine, std::vector& closest_settlements) noexcept { + move(engine); + marriage(); + birth(); + emigration(closest_settlements); + } + + /// @brief On update. + /// @brief 更新 + void onUpdate() noexcept { + ageUpdate(); + death(); + } + + private: + /// @brief 集落id + std::uint_least32_t id; + /// @brief エージェントの配列 + std::vector agents; + /// @brief 集落の座標 + std::vector positions; + + /// @brief Move. + /// @brief 移動 + void move(std::mt19937& engine) noexcept { + // 0.1%の確率で移動 + std::uniform_int_distribution<> dist(0, 1000); + if (dist(engine) != 0) return; + + // 座標を移動 + // TODO: 移動先の座標を決定 + + } + + /// @brief Marriage. + /// @brief 婚姻 + void marriage() noexcept { + // TODO: 結婚 + } + + /// @brief Birth. + /// @brief 出産 + void birth() noexcept { + // TODO: 出産 + } + + /// @brief Emigration. + /// @brief 渡来 + void emigration(std::vector& closest_settlements) noexcept { + // TODO: 渡来 + } + + /// @brief Age update. + /// @brief 年齢更新 + void ageUpdate() noexcept { + for (Agent& agent : agents) { + agent.incrementAge(); + } + } + + /// @brief Death. + /// @brief 死亡 + void death() noexcept { + agents.erase(std::remove_if(agents.begin(), agents.end(), [](const Agent& agent) { return agent.isDead(); }), agents.end()); + } + + }; + +} + +#endif // !PAX_SAPIENTICA_SETTLEMENT_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp new file mode 100644 index 000000000..07eb62932 --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp @@ -0,0 +1,99 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_SETTLEMENT_SIMULATOR_HPP +#define PAX_SAPIENTICA_SETTLEMENT_SIMULATOR_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include +#include +#include + +#include +#include +#include + +namespace paxs { + + template + class SettlementSimulator { + public: + using Agent = paxs::Agent; + using Environment = paxs::Environment; + using Settlement = paxs::Settlement; + using Vector2 = paxs::Vector2; + + constexpr explicit SettlementSimulator() = default; + + explicit SettlementSimulator(const std::string& setting_file_path, const Vector2& start_position, const Vector2& end_position, const int z, const unsigned seed = 0) : + environment(std::make_unique(setting_file_path, start_position, end_position, z)), gen(seed) { + if (z <= 0) { + Logger logger("Save/error_log.txt"); + const std::string message = "Z must be greater than 0."; + logger.log(Logger::Level::ERROR, __FILE__, __LINE__, message); + throw std::runtime_error(message); + } + if (start_position.x < 0 || start_position.y < 0 || end_position.x < 0 || end_position.y < 0) { + Logger logger("Save/error_log.txt"); + const std::string message = "Start position and end position must be greater than or equal to 0."; + logger.log(Logger::Level::ERROR, __FILE__, __LINE__, message); + throw std::runtime_error(message); + } + } + + /// @brief Initialize the simulator. + /// @brief 集落の初期化 + /// @details 集落をクリアし、地域ごとに指定されたエージェント数になるようにランダムに配置する + void init() { + settlements.clear(); + randomizeSettlements(); + } + + /// @brief Run the simulation for the specified number of steps. + /// @brief シミュレーションを指定されたステップ数だけ実行する + void run(const int step_count) noexcept { + for(int i = 0; i < step_count; ++i) { + step(); + } + } + + /// @brief Execute the simulation for the one step. + /// @brief シミュレーションを1ステップ実行する + void step() noexcept { + for (auto& settlement : settlements) { + settlement.preUpdate(); + } + + for (auto& settlement : settlements) { + settlement.onUpdate(); + } + } + + private: + std::vector settlements; + std::shared_ptr environment; + std::mt19937 gen; // 乱数生成器 + std::uniform_int_distribution<> gender_dist{0, 1}; // 性別の乱数分布 + std::uniform_int_distribution<> life_exp_dist{50, 100}; // 寿命の乱数分布 + + /// @brief Randomly place settlements. + /// @brief 集落をランダムに配置する + void randomizeSettlements() noexcept { + // TODO: 未実装 + } + + }; +} + +#endif // !PAX_SAPIENTICA_SETTLEMENT_SIMULATOR_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp index 023018bce..f40bbcdec 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp @@ -18,6 +18,12 @@ namespace paxs { constexpr int pixel_size = 256; // 1画像あたりの縦横のピクセル数 + + constexpr int unit_group_min = 11; // 単位集団の最小人数 + constexpr int unit_group_max = 40; // 単位集団の最大人数 + constexpr int basic_group_min = 41; // 基礎集団の最小人数 + constexpr int basic_group_max = 240; // 基礎集団の最大人数 + constexpr int composite_settlement_min = 82; // 複合集落の最小人数 } #endif // !PAX_SAPIENTICA_SIMULATION_SIMULATION_CONST_HPP \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/Simulator.hpp b/Library/PAX_SAPIENTICA/Simulation/Simulator.hpp index 54482a017..a71b37d7c 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Simulator.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Simulator.hpp @@ -88,11 +88,11 @@ namespace paxs { agent.move(); } catch (const std::runtime_error&) { Logger logger("Save/error_log.txt"); - logger.log(Logger::Level::ERROR, __FILE__, __LINE__, "Failed to move agent. Agent id: " + agent.getId()); + logger.log(Logger::Level::ERROR, __FILE__, __LINE__, "Failed to move agent. Agent id: " + std::to_string(agent.getId())); } } - agents.erase(std::remove_if(agents.begin(), agents.end(),[](const Agent& agent) { return agent.isDead(); }),agents.end()); + agents.erase(std::remove_if(agents.begin(), agents.end(), [](const Agent& agent) { return agent.isDead(); }), agents.end()); } @@ -135,7 +135,8 @@ namespace paxs { throw std::runtime_error(message); } - agents.push_back(Agent( "", "", position, static_cast(gender_dist(gen)), age_dist(gen), life_exp_dist(gen), environment)); + // TODO: uuidの生成 + agents.push_back(Agent( 0, "", position, static_cast(gender_dist(gen)), age_dist(gen), life_exp_dist(gen), environment)); } StatusDisplayer::displayProgressBar(agent_count, agent_count); std::cout << std::endl; diff --git a/Library/PAX_SAPIENTICA/Simulation/UnitGroup.hpp b/Library/PAX_SAPIENTICA/Simulation/UnitGroup.hpp new file mode 100644 index 000000000..8381a52db --- /dev/null +++ b/Library/PAX_SAPIENTICA/Simulation/UnitGroup.hpp @@ -0,0 +1,48 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#ifndef PAX_SAPIENTICA_UNIT_HPP +#define PAX_SAPIENTICA_UNIT_HPP + +/*########################################################################################## + +##########################################################################################*/ + +#include +#include + +namespace paxs { + + /// @brief A class that represents a unit group. + /// @brief 単位集団を表すクラス + template + class UnitGroup : public BaseGroup + { + public: + using Agent = paxs::Agent; + using Vector2 = paxs::Vector2; + constexpr explicit UnitGroup(const std::uint_least32_t& id, const Vector2& position) noexcept : BaseGroup(id), position(position) {} + void addAgent(const Agent& agent) override { + if (this->agents.size() + 1 < unit_group_max) { + this->agents.push_back(agent); + } else { + throw std::runtime_error("The number of agents in the unit group has reached the limit."); + } + } + + private: + /// @brief 単位集団の位置 + Vector2 position; + }; + +} + +#endif // !PAX_SAPIENTICA_UNIT_HPP \ No newline at end of file diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BaseGroupIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BaseGroupIncludeTest.cpp new file mode 100644 index 000000000..f9f144ca9 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BaseGroupIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BasicGroupIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BasicGroupIncludeTest.cpp new file mode 100644 index 000000000..2c068d542 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/BasicGroupIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/CompositeSettlementIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/CompositeSettlementIncludeTest.cpp new file mode 100644 index 000000000..67f5b9de6 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/CompositeSettlementIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/GroupSimulatorIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/GroupSimulatorIncludeTest.cpp new file mode 100644 index 000000000..0769c9cc6 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/GroupSimulatorIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementIncludeTest.cpp new file mode 100644 index 000000000..6793ee14d --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementSimulatorIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementSimulatorIncludeTest.cpp new file mode 100644 index 000000000..02695f211 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/SettlementSimulatorIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/UnitGroupIncludeTest.cpp b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/UnitGroupIncludeTest.cpp new file mode 100644 index 000000000..c7d35ee06 --- /dev/null +++ b/Project/IncludeTest/source/PAX_SAPIENTICA/Simulation/UnitGroupIncludeTest.cpp @@ -0,0 +1,3 @@ +#include + +int main(){} diff --git a/Project/UnitTest/source/Simulation/AgentUnitTest.cpp b/Project/UnitTest/source/Simulation/AgentUnitTest.cpp index 434ebb10c..248840fc0 100644 --- a/Project/UnitTest/source/Simulation/AgentUnitTest.cpp +++ b/Project/UnitTest/source/Simulation/AgentUnitTest.cpp @@ -29,42 +29,42 @@ class EnvironmentMock : public paxs::Environment { TEST (AgentUnitTest, move) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); agent.move(paxs::Vector2(1, 1)); EXPECT_EQ(agent.getPosition(), paxs::Vector2(1, 1)); } TEST (AgentUnitTest, isDead) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent("0", "test", paxs::Vector2(0, 0), 0, 10, 5, env); + paxs::Agent agent(0, "test", paxs::Vector2(0, 0), 0, 10, 5, env); EXPECT_TRUE(agent.isDead()); } TEST (AgentUnitTest, getAge) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); EXPECT_EQ(agent.getAge(), 0); } TEST (AgentUnitTest, updateAge) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); agent.incrementAge(); EXPECT_EQ(agent.getAge(), 1); } TEST (AgentUnitTest, getGender) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); EXPECT_EQ(agent.getGender(), 0); } TEST (AgentUnitTest, operatorEqual) { std::shared_ptr> env = std::make_shared>(); - paxs::Agent agent1("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); - paxs::Agent agent2("0", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent1(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent2(0, "test", paxs::Vector2(0, 0), 0, 0, 0, env); EXPECT_TRUE(agent1 == agent2); - paxs::Agent agent3("1", "test", paxs::Vector2(0, 0), 0, 0, 0, env); + paxs::Agent agent3(1, "test", paxs::Vector2(0, 0), 0, 0, 0, env); EXPECT_FALSE(agent1 == agent3); } diff --git a/Project/UnitTest/source/Simulation/GroupUnitTest.cpp b/Project/UnitTest/source/Simulation/GroupUnitTest.cpp new file mode 100644 index 000000000..1aa72752a --- /dev/null +++ b/Project/UnitTest/source/Simulation/GroupUnitTest.cpp @@ -0,0 +1,19 @@ +/*########################################################################################## + + PAX SAPIENTICA Library 💀🌿🌏 + + [Planning] 2023 As Project + [Production] 2023 As Project + [Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA + [License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/ + +##########################################################################################*/ + +#include + +#include + +TEST (UnitGroupUnitTest, constructor) { + paxs::UnitGroup group(0, {0, 0}); + EXPECT_EQ(group.getId(), 0); +}