I had problems finding a good question title, so feel free to improve on that.
I want to implement an Entity Component System in C++, and wish to use TDD for the first time. Now I have doubts about how useful TDD is when the target "architecture" is already specified, but want to try it anyway. My problem is more of a TDD problem though, and I could have run into it in another context as well:
The first test was supposed to check that I can add a
Component to an
Entity as an
Entity should "possess" a set of
Components (maybe this is a bad test and the problem lies here already?). So far no code exists and I'm facing a dilemma which might not be one. I could write a test that does this:
Entity e; Component c; e.add(c);
But how would I assert that the
add has worked correctly? I know I am going to need some sort of
has_component method sooner or later, but I shouldn't implement additional functionality now, or should I?
I could also make
Entity have some list type in its public interface and use that in the test, and refactor that "away" later.
What is a correct approach here? It might be my mindset for TDD is totally off, so I'm grateful for any input!