Skip to content

Conversation

thk123
Copy link

@thk123 thk123 commented Nov 29, 2016

Added a new class to generate Unity style tests. These include nice reporting of whether the test passes or fails as well as handling more sophisticated assertions.

Most of the regression files are modified as the format of the test is different.

Copy link
Author

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

A checklist of newly introduced whitespace changes I should fix. Can't make it a request changes on my own PR...

@@ -305,9 +306,10 @@ bool bmc_covert::operator()()
for(const auto & it : goal_map)
if(it.second.satisfied) goals_covered++;

if (bmc.options.get_bool_option("gen-c-test-case"))
if (bmc.options.get_option("gen-c-test-case") != "")
Copy link
Author

Choose a reason for hiding this comment

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

Spacing

{

std::string generator_str = bmc.options.get_option("gen-c-test-case");
Copy link
Author

Choose a reason for hiding this comment

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

Spacing

c_simple_test_case_generatort gen(get_message_handler(), bmc.options,
bmc.ns.get_symbol_table(), goto_functions, test, test_case_no, true);
std::unique_ptr<c_test_case_generatort> gen;
if(generator_str == "unity")
Copy link
Author

Choose a reason for hiding this comment

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

Spacing in this block x4

@@ -48,11 +49,14 @@ class c_test_case_generatort : public messaget

protected:
virtual void add_includes(c_test_filet &test_file);
virtual void add_main_method(c_test_filet &test_file,
virtual void add_main_method(class c_test_filet &test_file,
Copy link
Author

Choose a reason for hiding this comment

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

Parameter on next line

#include <algorithm>
#include <util/config.h>

c_unity_test_case_generatort::c_unity_test_case_generatort(message_handlert &_message_handler,
Copy link
Author

Choose a reason for hiding this comment

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

Does constructor need comment?

size_t test_index,
bool using_test_main)
: c_test_case_generatort(_message_handler, options, symbol_table,
goto_functions, test, test_index, using_test_main)
Copy link
Author

Choose a reason for hiding this comment

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

Each of these should be on a separate line.

included inside this file
\*******************************************************************/
void c_unity_test_case_generatort::add_main_method(c_test_filet &test_file,
const testt &test)
Copy link
Author

Choose a reason for hiding this comment

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

Parameter on separate line.

return_value_var - The name of the variable (including relevant nesting)
Purpose: Add an assertion for a unity expression
\*******************************************************************/
void c_unity_test_case_generatort::add_simple_assert(c_test_filet &test_file,
Copy link
Author

Choose a reason for hiding this comment

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

Parameter on separate line.

class c_unity_test_case_generatort : public c_test_case_generatort
{
public:
c_unity_test_case_generatort(message_handlert &_message_handler,
Copy link
Author

Choose a reason for hiding this comment

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

Parameter on new line


protected:
virtual void add_includes(class c_test_filet &test_file) override;
virtual void add_main_method(class c_test_filet &test_file,
Copy link
Author

Choose a reason for hiding this comment

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

Parameter on new line x4

@thk123 thk123 force-pushed the unity-test-generation branch from d69dfd5 to 33a98bb Compare November 29, 2016 13:48
Copy link
Owner

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

very nice

const testt &test,
size_t test_index,
bool using_test_main)
: c_test_case_generatort(
Copy link
Owner

Choose a reason for hiding this comment

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

put colon on the previous line; "c_test_case_generator(" is aligned with bool; its arguments are indented (as they are already)

thk123 added 2 commits November 29, 2016 15:10
Fixed white space and other linting errors in lines touched by this PR.
@thk123 thk123 force-pushed the unity-test-generation branch from 33a98bb to eed8e8a Compare November 29, 2016 15:11
@thk123 thk123 closed this Apr 4, 2017
@thk123 thk123 deleted the unity-test-generation branch April 4, 2017 15:46
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