Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate separate Tester::connectPorts source file #934

Closed
timcanham opened this issue Aug 18, 2021 · 6 comments · Fixed by #1786
Closed

Autogenerate separate Tester::connectPorts source file #934

timcanham opened this issue Aug 18, 2021 · 6 comments · Fixed by #1786

Comments

@timcanham
Copy link
Collaborator

F´ Version 2.0
Affected Component

Feature Description

Currently, Tester::connectPorts() is generated by the generate impl --ut and placed in the Tester.cpp file. This becomes a maintenance annoyance and causes asserts if it's not corrected if a new port is added.

The proposal would be to generate this function into a separate .cpp file that would be treated like the other unit test files and generated each time the test is compiled.

Rationale

It makes maintaining unit tests a lot easier, and it isn't intuitive to know you have to go update this function when you add a port.

@LeStarch
Copy link
Collaborator

If we are going to fix this, we need to make sure the for connections for port arrays use non-hardcoded values. I often have to rewrite these methods by hand to fix that oversight.

@timcanham
Copy link
Collaborator Author

What do you mean by for connections?

@LeStarch
Copy link
Collaborator

When you have an array port, it makes a for loop:

for (i = 0; i < 3; i++) {
   //connect port @ i
}

However, instead of using the constant depicting the array size, it uses a hardcoded integer. If one changes AcConstants.ini or that port size, this hardcoded int needs to be updated to.

@timcanham
Copy link
Collaborator Author

If the ut code is regenerated, does the port size get updated?

@LeStarch
Copy link
Collaborator

@timcanham would we be able to override this autocode? Occasionally we need to override it.

e.g. for the hub unit tests, we create 2 hubs and cross-wire them together to proved that the outside interfaces of the hubs work in tandem.

@timcanham
Copy link
Collaborator Author

timcanham commented Aug 18, 2021

Since the connection functions are always re-callable, you can re-connect any way you like. You could also just comment out the call to connectPorts() from the Tester constructor and do your own connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants