Skip to content

Commit

Permalink
feat: use coponent like id
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 16, 2024
1 parent 3c2073f commit e1fe8ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
7 changes: 4 additions & 3 deletions parse-resolver-runtime/parse-resolver-runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1136,14 +1136,15 @@ auto ecsact_set_system_notify_component_setting(
}

auto ecsact_meta_component_type( //
ecsact_component_id component_id
ecsact_component_like_id comp_like_id
) -> ecsact_component_type {
auto comp_def = comp_defs.find(component_id);
auto comp_def =
comp_defs.find(static_cast<ecsact_component_id>(comp_like_id));
if(comp_def == comp_defs.end()) {
// NOTE: this is temporary until we remove the transient fns and instead
// embrace components with transient statement params
auto trans_def =
trans_defs.find(static_cast<ecsact_transient_id>(component_id));
trans_defs.find(static_cast<ecsact_transient_id>(comp_like_id));
if(trans_def != trans_defs.end()) {
return ECSACT_COMPONENT_TYPE_TRANSIENT;
}
Expand Down
19 changes: 14 additions & 5 deletions test/stream_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,31 @@ TEST_F(StreamComponent, SanityCheck) {
auto comp_id = get_component_by_name(pkg_id, "MyNormieComponent");
ASSERT_TRUE(comp_id);

ASSERT_EQ(ecsact_meta_component_type(*comp_id), ECSACT_COMPONENT_TYPE_NONE);
auto comp_like_id = ecsact_meta_component_type(
ecsact_id_cast<ecsact_component_like_id>(*comp_id)
);

ASSERT_EQ(comp_like_id, ECSACT_COMPONENT_TYPE_NONE);
}

TEST_F(StreamComponent, HasStreamType) {
auto comp_id = get_component_by_name(pkg_id, "MyStreamComponent");
ASSERT_TRUE(comp_id);

ASSERT_EQ(ecsact_meta_component_type(*comp_id), ECSACT_COMPONENT_TYPE_STREAM);
auto comp_type = ecsact_meta_component_type(
ecsact_id_cast<ecsact_component_like_id>(*comp_id)
);

ASSERT_EQ(comp_type, ECSACT_COMPONENT_TYPE_STREAM);
}

TEST_F(StreamComponent, HasLazyStreamType) {
auto comp_id = get_component_by_name(pkg_id, "MyLazyStreamComponent");
ASSERT_TRUE(comp_id);

ASSERT_EQ(
ecsact_meta_component_type(*comp_id),
ECSACT_COMPONENT_TYPE_LAZY_STREAM
auto comp_type = ecsact_meta_component_type(
ecsact_id_cast<ecsact_component_like_id>(*comp_id)
);

ASSERT_EQ(comp_type, ECSACT_COMPONENT_TYPE_LAZY_STREAM);
}

0 comments on commit e1fe8ab

Please sign in to comment.