-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Generated tests for function can't be compiled
char* reverse_str(char* str) {
int n = strlen(str);
char* reversed = malloc(n + 1);
for (int i = 0; i < n; i++) {
reversed[i] = str[n - 1 - i];
}
reversed[n] = '\0';
return reversed;
}
Tests
TEST(regression, reverse_str_test1)
{
char str[] = {'c', '\0', 'c', 'c', 'c', 'c', 'c', 'c', 'c', '\0'};
char * actual = reverse_str(str);
char expected[] = "c";
for (int it_10_0 = 0; it_10_0 < 1; it_10_0 ++) {
EXPECT_EQ(actual[it_10_0], "c");
}
char expected_str[] = {'c', '\0', 'c', 'c', 'c', 'c', 'c', 'c', 'c', '\0'};
for (int it_11_0 = 0; it_11_0 < 10; it_11_0 ++) {
EXPECT_EQ(expected_str[it_11_0], str[it_11_0]);
}
}
In line EXPECT_EQ(actual[it_10_0], "c");
comparing char with string literal
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done