-
Notifications
You must be signed in to change notification settings - Fork 4
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
More array.h
and field.h
tests
#159
Conversation
* Recursive globbing unit test source files. * Specify test_*.cpp Co-authored-by: Will Graham <[email protected]> Co-authored-by: Will Graham <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean about these not being thrilling.
Feels like we could write a bit more structured testing with fixtures or tester classes or something.
A sketch:
class AbsArrayTest {
virtual bool is_empty() = 0;
// ...
// and actually implement these on the parent
void test_empty_construction_fails();
void test_invalid_construction();
void test_too_few_fields();
void test_too_many_fields();
void run_all_tests() {
test_empty_construction_fails();
test_invalid_construction();
test_too_few_fields();
test_too_many_fields();
}
}
class IncidentFieldTest : public AbsArrayTests {
// ...
}
class FrequencyVectorsTest : public AbsArrayTests {
// ...
}
And plop all of the class-specific setup in the concrete instance. Then just call the same run_all_the_tests
method on each class.
... I've no idea how easy this would be in the catch2 framework.
Co-authored-by: Sam Cunliffe <[email protected]>
Have linked your original comment to #165 -> once this is in, (and possibly also #171, which has many of the same problems) I can make some nice classes. |
Ready to merge, then? |
Mentioning #165
A number of these classes rely on methods in
matlabio.h
. Towards the end of this list, I stopped writing near-identical tests for the constructors/initialise()
methods of these classes, because this functionality can be checked with unit tests on the aforementioned file. Additionally, any methods that usematlabio.h
be redundant when #70 is completed.DispersiveMultiLayer
tests | Closes #158FrequencyVector
tests | Closes #161nullptr
sinitialise()
: Tests that providing a pointer to an empty array exitsinitialise()
: Tests that providing a struct with too few/many fields, or an array that isn't a struct, throws an errorinitialise()
: Tests that providing a struct of the correct fields can have its data copied into theFrequencyVector
classDTilde
tests | Closes #162nullptr
as appropriateinitialise()
: Tests that providing a pointer to an empty array exitsinitialise()
: Tests that providing a struct with too few/many fields, or an array that isn't a struct, throws an errorinitialise()
: Tests that providing a struct with the correct fields can have its data pointed to in theDTilde
{x,y}
attributesIncidentField
tests | Closes #163IncidentField
{x,y}
attributes, and this data is as expectedFieldSample
tests | Closes #166FieldSample
objects via structs with populated arraystensor
value is created with the correct shapetensor
DetectorSensitivityArray
tests | Closes #167fftw_destroy
's ability to handlenullptrs
initialise()
successfully creates a block of memory of the correct size that can be written to