-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor to CMocka #62
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
base: main
Are you sure you want to change the base?
Conversation
teadetime
left a comment
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.
Looks amazing, did a look through of it all -- need to understand the composing bit but this looks much cleaner!
| project(OlinCoin C CXX) | ||
| enable_testing() | ||
| #set(CMAKE_BUILD_TYPE Debug) | ||
| set(CMAKE_BUILD_TYPE Debug) |
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.
Change back before final PR
|
|
||
| if (block->txs != NULL) { | ||
| for (unsigned int i = 0; i < block->num_txs; i++) | ||
| if (block->txs[i] != NULL) |
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.
This check isn't actually needed, it is done in free_tx
| @@ -0,0 +1,17 @@ | |||
| add_library(fixtures STATIC | |||
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.
interesting that the fixtures end up requiring all our base libraries
| add_subdirectory(global) | ||
| add_subdirectory(txs) | ||
| add_subdirectory(utils) | ||
| add_subdirectory(fixtures) |
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 you handled the cmake stuff very cleanly here
| @@ -0,0 +1,66 @@ | |||
| #include "fixtures_block.h" | |||
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.
This looks super cool
| } | ||
|
|
||
| int fixture_setup_utxo_to_tx(void **state) { | ||
| utxo_to_tx_init(); |
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.
Pretty sure this is done in mempool init...
| composition = *state; | ||
| *state = NULL; | ||
|
|
||
| int i = 0; |
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.
Unclear what composing means or composed fixture (Very small comments in the headers might clear this up)
| sub_state = malloc(sizeof(void*) * 2); | ||
| fixture_setup_unlinked_tx(&sub_state[0]); | ||
| fixture_setup_unlinked_keypair(&sub_state[1]); | ||
| *state = sub_state; |
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.
single pointer being set to a double pointer -> not sure what is actually happening here
| return NULL; | ||
| static void test_utxo_pool_init(void **state) { | ||
| (void)state; | ||
| assert_ptr_not_equal(utxo_pool_db, NULL); |
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.
Think we may have discused that we should not check leveldb to Null, maybe we test the init funciton for a valid return ?
Closes #32, Closes #52
In progress, moving tests over to CMocka fixture based structure.