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

Add unit tests (using libcheck) #238

Merged
merged 57 commits into from
Feb 1, 2019
Merged

Conversation

saxbophone
Copy link
Owner

Please test this Travis CI!

Added some more tests for bitmap struct type
I wrote a failing test (and found a bug!)
I left out test cases for memory allocation errors, as I haven't found a way to reliably generate these errors
- Identified a bug in sxbp_copy_figure() which is caused by neglecting to tell memcpy() the correct number of bytes to be copied --we need to multiply the figure's size by sizeof(sxbp_line_t) to do this properly, the current implementation cuts this well short
- Added randomness to bitmap copy test
- Changed randomness derivation to use bit-masking rather than modulo
- Seed C's rand() in main unit tests file for random variety
Added note to add in extra test for when options.max_lines is overridden
In other news, I've just realised that I'm neglecting to free() alloc'ed memory in my unit tests!
@saxbophone
Copy link
Owner Author

Note: all copying functions need additional tests to verify how they handle empty/blank objects or objects with NULL data pointers. Function specs also need updating to clarify this, otherwise worst outcome could be a NULL pointer dereference error.

@saxbophone saxbophone force-pushed the josh/232-unit-testing-with-check branch from a43106f to 96af0e7 Compare February 1, 2019 21:24
@saxbophone
Copy link
Owner Author

Hurrah! The tests pass!

@saxbophone saxbophone merged commit 7a2b706 into develop Feb 1, 2019
@saxbophone saxbophone deleted the josh/232-unit-testing-with-check branch February 1, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant