Skip to content

Fix cellular unittests #8315

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

Merged
merged 2 commits into from
Oct 8, 2018
Merged

Fix cellular unittests #8315

merged 2 commits into from
Oct 8, 2018

Conversation

kivaisan
Copy link
Contributor

@kivaisan kivaisan commented Oct 3, 2018

Description

Fix cellular UT instability. CellularSocket class did not have constructor and therefore it's members were not initialized.

Also fixed some build warnings and style issues.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

Kimmo Vaisanen added 2 commits October 3, 2018 14:44
Missing CellularSocket constructor caused uninitialized values to be used.

Also changed comparision macros to ASSERT_EQ as suggested by GoogleTest guide.
@kivaisan
Copy link
Contributor Author

kivaisan commented Oct 3, 2018

@AnttiKauppila @AriParkkila @mirelachirica @jarvte please review.


char table[] = "1.2.3.4.5.65.7.8.9.10.11\0";
ATHandler_stub::ssize_value = -1;
ATHandler_stub::bool_value = true;
ATHandler_stub::read_string_value = table;
EXPECT_TRUE(NULL == st.get_ip_address());
EXPECT_TRUE(st.get_ip_address() == NULL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Didi you mean EXPECT_EQ(st.get_ip_address(), NULL); ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NULL is an exception. GTest does not allow comparision to NULL with EXPECT_EQ.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the change of the operands order relevant to how the fail is reported or just a code style issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a code style to follow other EXCEPT checks.

According to Google Test documentation:

However, when possible, ASSERT_EQ(actual, expected) is preferred to ASSERT_TRUE(actual == expected), since it tells you actual and expected's values on failure.

So I just used the same format for all.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 6, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 6, 2018

Build : SUCCESS

Build number : 3258
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8315/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 6, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants