Skip to content
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

Fixes #3214 UAIFile unittest comparison between signed and unsigned #3215

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/unit/io/UAIFile_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(UAIFileTest, preamble)
factors_scope_in);

const char net_type_expected[] = "MARKOV";
EXPECT_EQ(net_type.vlen, strlen(net_type_expected));
EXPECT_EQ(net_type.vlen, static_cast<int32_t>(strlen(net_type_expected)));
Copy link
Member

Choose a reason for hiding this comment

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

Minor: Technically, this is not safe. Think of possible overflows.
You could rather cast the vlen to unsigned int and assert for positivity first.

for (int32_t i=0; i<net_type.vlen; i++)
EXPECT_EQ(net_type[i], net_type_expected[i]);

Expand Down