Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <algorithm>

extern "C" {
#include "cstack.h"
}
Expand Down Expand Up @@ -29,7 +31,8 @@ TEST(AllocationTests, SingleAllocation)
TEST(AllocationTests, SeveralAllocations)
{
const size_t count = 10;
hstack_t stacks[count] = {-1};
hstack_t stacks[count] = {0};
std::fill_n(stacks, count, -1);
for (size_t i = 0; i < count; ++i)
{
stacks[i] = stack_new();
Expand Down Expand Up @@ -74,7 +77,8 @@ TEST_F(ModifyTests, PushBadArgs)
TEST_F(ModifyTests, PopBadArgs)
{
const size_t size = 5;
const int data_in[size] = {1};
int data_in[size] = {0};
std::fill_n(data_in, size, 1);
Copy link

Choose a reason for hiding this comment

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

Может для однозначности понимания теста в 87 строчке сделать также?

int data_out[size-1] = {0}
std::fill_n(data_out, size - 1, 0)

С точки зрения выполняемого кода будет одна лишняя команда, но она добавит однозначности в сам тест

stack_push(stack, &data_in, sizeof(data_in));
ASSERT_EQ(stack_size(stack), 1u);

Expand Down