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
Migrate listpack.c unit tests to new test framework #484
base: unstable
Are you sure you want to change the base?
Conversation
2b605d6
to
35a1a2e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #484 +/- ##
============================================
+ Coverage 69.78% 69.80% +0.02%
============================================
Files 109 109
Lines 61795 61795
============================================
+ Hits 43122 43138 +16
+ Misses 18673 18657 -16
|
@b1zantine Looks like the build is failing, can you double check it's working when you run:
|
Signed-off-by: b1zantine <b1zantine.king@gmail.com>
35a1a2e
to
b271ce2
Compare
@madolson |
@@ -28,6 +28,8 @@ | |||
#define KBLUE "\33[34m" | |||
#define KRESET "\33[0m" | |||
|
|||
#define TEST(name) printf("test — %s\n", name); |
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.
As per the new test framework, probably we can stop using this TEST
which was originally used for printing different test case names.
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.
Yes, let's stop using TEST, which really should have been individual tests.
unsigned char intbuf[LP_INTBUF_SIZE]; | ||
int accurate = (flags & UNIT_TEST_ACCURATE); | ||
|
||
TEST("Create int list") { |
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 think It would be better if we break these TEST
into different test case functions. For example, something like:
int test_listpackCreateIntList(int argc, char **argv, int flags)
Similarly for other places as well, when possible.
@@ -45,98 +45,6 @@ | |||
#include "serverassert.h" | |||
#include "util.h" | |||
|
|||
#define LP_HDR_SIZE 6 /* 32 bit total len + 16 bit number of elements. */ |
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'm a little hesitant about exporting all this, since it complicates the header file a bit. I think I would rather use the alternative testing strategy we have, which is to #include "../listpack.c"
in the test file, similar to
Line 4 in c7ad9fe
#include "../intset.c" |
This PR migrates all tests related to listpack.c into new test framework as part of the parent issue #428.