From 7deb6b74080b5c19ff9e68876dd145085c4ba9c6 Mon Sep 17 00:00:00 2001 From: "o.pyhov" Date: Tue, 28 Nov 2023 12:03:29 +0500 Subject: [PATCH] added std::fill_n --- test.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test.cpp b/test.cpp index 657219b..1c2a20c 100644 --- a/test.cpp +++ b/test.cpp @@ -1,6 +1,8 @@ #include #include +#include + extern "C" { #include "cstack.h" } @@ -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(); @@ -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); stack_push(stack, &data_in, sizeof(data_in)); ASSERT_EQ(stack_size(stack), 1u);