13 #include <gtest/gtest.h> 14 #include "../../include/ecl/containers/array.hpp" 15 #include "../../include/ecl/containers/push_and_pop.hpp" 30 TEST(PushAndPopTests,constructors)
33 EXPECT_EQ(2, pp_dynamic[0]);
34 EXPECT_EQ(2, pp_dynamic[1]);
35 EXPECT_EQ(2, pp_dynamic[2]);
36 EXPECT_EQ(2, pp_dynamic[3]);
39 EXPECT_EQ(2, pp_fixed[0]);
40 EXPECT_EQ(2, pp_fixed[1]);
41 EXPECT_EQ(2, pp_fixed[2]);
42 EXPECT_EQ(2, pp_fixed[3]);
45 TEST(PushAndPopTests, pop_and_push )
48 for (
int i = 0; i < 4; i++)
53 EXPECT_EQ(0.0, pp_dynamic[0]);
54 EXPECT_EQ(1.0, pp_dynamic[1]);
55 EXPECT_EQ(2.0, pp_dynamic[2]);
56 EXPECT_EQ(3.0, pp_dynamic[3]);
60 EXPECT_EQ(2, pp_dynamic.
size());
63 EXPECT_EQ(2.0, pp_dynamic[0]);
64 EXPECT_EQ(3.0, pp_dynamic[1]);
67 TEST(PushAndPopTests, push_back_only )
70 for (
unsigned int i = 0; i < 4; i++)
75 EXPECT_EQ( 3, pp.
size());
77 for (
unsigned int i = 4; i < 8; i++)
80 EXPECT_EQ( 3, pp.
size());
84 for (
unsigned int i = 0; i < 4; i++)
86 pp_dynamic.push_back(i);
89 EXPECT_EQ( 3, pp_dynamic.size());
91 for (
unsigned int i = 4; i < 8; i++)
93 pp_dynamic.push_back(i);
94 EXPECT_EQ( 3, pp_dynamic.size());
98 TEST(PushAndPopTests, pop_front_only )
102 for (
unsigned int i = 0; i < 2; i++)
107 EXPECT_EQ( 2, pp.
size());
109 for (
unsigned int i = 0; i < 2; i++)
112 EXPECT_EQ( (2-1-i), pp.
size());
124 for (
unsigned int i = 0; i < 2; i++)
126 pp_dynamic.push_back(i);
129 EXPECT_EQ( 2, pp_dynamic.size());
131 for (
unsigned int i = 0; i < 2; i++)
133 pp_dynamic.pop_front();
134 EXPECT_EQ( (2-1-i), pp_dynamic.size());
160 int main(
int argc,
char **argv)
162 testing::InitGoogleTest(&argc, argv);
163 return RUN_ALL_TESTS();
Fixed size container with a few bells and whistles.
Surpport push and pack operation.
unsigned int size() const
int main(int argc, char **argv)
void push_back(const Type &datum)
Pushes an element onto the back of the container.
TEST(PushAndPopTests, constructors)
#define ecl_compile_time_concept_check(Model)