@@ -4581,11 +4581,10 @@ void ComponentLifecycle_on_replace_other_table_new_entity(void) {
45814581 ecs_set (world , e , Position , {10 , 20 });
45824582 test_int (ctx .invoked , 1 );
45834583
4584- /* prev_table captured before flecs_ensure: root table, no Position.
4585- * set_fields=2: bit 0 unset (no old value), bit 1 set (new value). */
4584+ /* prev_table captured before flecs_ensure: root table, no Position. */
45864585 test_assert (ctx .other_table == prev );
4587- test_assert (!( ctx .set_fields & 1 ) );
4588- test_assert (ctx .set_fields & 2 );
4586+ test_assert (ctx .set_fields == 3 );
4587+ test_assert (! ecs_table_has_id ( world , ctx .other_table , ecs_id ( Position )) );
45894588
45904589 ecs_fini (world );
45914590}
@@ -4612,10 +4611,10 @@ void ComponentLifecycle_on_replace_other_table_existing_entity(void) {
46124611 ecs_set (world , e , Position , {10 , 20 });
46134612 test_int (ctx .invoked , 1 );
46144613
4615- /* prev_table = {Velocity} before ensure; set_fields=2 : Position not yet in prev. */
4614+ /* prev_table = {Velocity} before ensure: Position not yet in prev. */
46164615 test_assert (ctx .other_table == prev );
4617- test_assert (!( ctx .set_fields & 1 ) );
4618- test_assert (ctx .set_fields & 2 );
4616+ test_assert (ctx .set_fields == 3 );
4617+ test_assert (! ecs_table_has_id ( world , ctx .other_table , ecs_id ( Position )) );
46194618
46204619 ecs_fini (world );
46214620}
@@ -4643,9 +4642,10 @@ void ComponentLifecycle_on_replace_other_table_set_existing(void) {
46434642 ecs_set (world , e , Position , {11 , 21 });
46444643 test_int (ctx .invoked , 1 );
46454644
4646- /* prev_table = {Position} (unchanged by ensure); set_fields=3 : Position in prev. */
4645+ /* prev_table = {Position} (unchanged by ensure): Position in prev. */
46474646 test_assert (ctx .other_table == table_with_pos );
46484647 test_assert (ctx .set_fields == 3 );
4648+ test_assert (ecs_table_has_id (world , ctx .other_table , ecs_id (Position )));
46494649
46504650 ecs_fini (world );
46514651}
@@ -4675,11 +4675,10 @@ void ComponentLifecycle_on_replace_other_table_batched_new_entity(void) {
46754675 ecs_defer_end (world );
46764676 test_int (ctx .invoked , 1 );
46774677
4678- /* Batch flush second-pass: uses start_table (root, no Position).
4679- * set_fields=2: bit 0 unset because start_table lacks Position. */
4678+ /* Batch flush second-pass: uses start_table (root, no Position). */
46804679 test_assert (ctx .other_table == start_table );
4681- test_assert (!( ctx .set_fields & 1 ) );
4682- test_assert (ctx .set_fields & 2 );
4680+ test_assert (ctx .set_fields == 3 );
4681+ test_assert (! ecs_table_has_id ( world , ctx .other_table , ecs_id ( Position )) );
46834682
46844683 ecs_fini (world );
46854684}
@@ -4712,6 +4711,7 @@ void ComponentLifecycle_on_replace_other_table_batched_existing(void) {
47124711 test_int (ctx .invoked , 1 );
47134712 test_assert (ctx .other_table == table_with_pos );
47144713 test_assert (ctx .set_fields == 3 );
4714+ test_assert (ecs_table_has_id (world , ctx .other_table , ecs_id (Position )));
47154715 ecs_defer_end (world );
47164716
47174717 ecs_fini (world );
@@ -4730,16 +4730,15 @@ void ComponentLifecycle_on_replace_other_table_entity_init(void) {
47304730 .ctx = & ctx ,
47314731 });
47324732
4733- /* init_table = r->table before any components added (root, no Position).
4734- * set_fields=2: bit 0 unset, new add. */
4733+ /* init_table = r->table before any components added (root, no Position). */
47354734 ecs_entity_t e = ecs_entity (world , {
47364735 .set = ecs_values (ecs_value (Position , {10 , 20 }))
47374736 });
47384737 test_int (ctx .invoked , 1 );
47394738
47404739 test_assert (ctx .other_table != ecs_get_table (world , e ));
4741- test_assert (!( ctx .set_fields & 1 ) );
4742- test_assert (ctx .set_fields & 2 );
4740+ test_assert (ctx .set_fields == 3 );
4741+ test_assert (! ecs_table_has_id ( world , ctx .other_table , ecs_id ( Position )) );
47434742
47444743 ecs_fini (world );
47454744}
0 commit comments