forked from storm-devs/storm-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting blade locators by updating the
equipment.*.locator
…
…attribute
- Loading branch information
Showing
8 changed files
with
182 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "attributes.h" | ||
|
||
#include <catch2/catch.hpp> | ||
|
||
namespace | ||
{ | ||
|
||
// TODO: Either move STRING_CODEC outside of Engine or make a re-usable codec for testing | ||
class TestStringCodec : public VSTRING_CODEC | ||
{ | ||
public: | ||
uint32_t GetNum() override | ||
{ | ||
return map_.size(); | ||
} | ||
|
||
uint32_t Convert(const char *pString) override | ||
{ | ||
std::string str(pString); | ||
const uint32_t hash = std::hash<std::string>{}(str); | ||
map_.emplace(hash, str); | ||
return hash; | ||
} | ||
|
||
uint32_t Convert(const char *pString, int32_t iLen) override | ||
{ | ||
std::string str(pString, iLen); | ||
const uint32_t hash = std::hash<std::string>{}(str); | ||
map_.emplace(hash, str); | ||
return hash; | ||
} | ||
|
||
const char *Convert(uint32_t code) override | ||
{ | ||
return map_[code].c_str(); | ||
} | ||
|
||
void VariableChanged() override | ||
{ | ||
} | ||
|
||
private: | ||
std::unordered_map<uint32_t, std::string> map_; | ||
}; | ||
|
||
} // namespace | ||
|
||
TEST_CASE("Match attribute path by pattern", "[config]") | ||
{ | ||
TestStringCodec string_codec{}; | ||
ATTRIBUTES attribute(string_codec); | ||
ATTRIBUTES *third = attribute.CreateSubAClass(&attribute, "first.second.third"); | ||
ATTRIBUTES *fourth = third->CreateAttribute("fourth", "value"); | ||
|
||
CHECK(MatchAttributePath("first.second.third.fourth", *fourth) ); | ||
CHECK_FALSE(MatchAttributePath("first.second.wrong.fourth", *fourth) ); | ||
CHECK_FALSE(MatchAttributePath("third.fourth", *fourth) ); | ||
CHECK_FALSE(MatchAttributePath("*.fourth", *fourth) ); | ||
CHECK_FALSE(MatchAttributePath("third", *fourth) ); | ||
CHECK(MatchAttributePath("first.*.third.fourth", *fourth) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
STORM_SETUP( | ||
TARGET_NAME location | ||
TYPE storm_module | ||
DEPENDENCIES animation collide core geometry model renderer sea sound_service util | ||
DEPENDENCIES animation blade collide core geometry model renderer sea sound_service util | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters