-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix cellular unittests #8315
Conversation
Missing CellularSocket constructor caused uninitialized values to be used. Also changed comparision macros to ASSERT_EQ as suggested by GoogleTest guide.
@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); |
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.
Didi you mean EXPECT_EQ(st.get_ip_address(), 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.
NULL is an exception. GTest does not allow comparision to NULL with EXPECT_EQ.
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.
Is the change of the operands order relevant to how the fail is reported or just a code style issue?
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.
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.
/morph build |
Build : SUCCESSBuild number : 3258 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2864 |
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