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 the foundation for automated unit testing using the Google Test framework #11

Merged
merged 26 commits into from
Jun 6, 2024

Conversation

Kardbord
Copy link
Owner

@Kardbord Kardbord commented Jun 5, 2024

Lots of changes in this one due to a pretty big reorganization, as well as the fact that my new neovim setup feels very strongly about the way things should be formatted. 😅 Still working out the kinks there.

Primarily, the purpose of these updates is to get us set up to write unit tests for the parser so we don't have to eyeball the output of spicy-driver manually each time we make a change. We can also set up a GitHub action to run the tests automatically on each PR and after each merge.

Changes:

  • Consolidated gtest, test data, and btest all under the testing directory
  • Added CMake logic to
    • generate C++ headers/sources from spicy, and link our tests against them
    • generate C++ headers containing embedded binary data from our .binpb test data (I may have gotten carried away here, but it beats hard coding relative paths into the unit tests)
  • Added a bare-bones unit test

Leaving this in a draft state for now, as it is blocked by zeek/spicy#1752.

CMakeLists.txt Outdated Show resolved Hide resolved
cmake/FindSpicyPlugin.cmake Outdated Show resolved Hide resolved
tools/build.sh Outdated Show resolved Hide resolved
@Kardbord Kardbord marked this pull request as ready for review June 6, 2024 04:48
@Kardbord Kardbord requested a review from TnekRex June 6, 2024 04:48
@Kardbord Kardbord marked this pull request as draft June 6, 2024 05:51
@Kardbord
Copy link
Owner Author

Kardbord commented Jun 6, 2024

Still need to add unit tests for i32 and i64 wire types.

@TnekRex TnekRex marked this pull request as ready for review June 6, 2024 12:16
Copy link
Collaborator

@TnekRex TnekRex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled down code base. Verified unit tests compile, run and all tests pass. I'll take a look at the implementation details as time permits - maybe take a shot at implementing the unit tests for I32 and I64 wire types as an exercise to get my head around gtest.

@TnekRex TnekRex merged commit 2815311 into dev Jun 6, 2024
4 checks passed
@TnekRex TnekRex deleted the unit-tests branch June 6, 2024 12:24
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.

2 participants