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++)
89 EXPECT_EQ( 3, pp_dynamic.
size());
91 for (
unsigned int i = 4; i < 8; 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++)
129 EXPECT_EQ( 2, pp_dynamic.
size());
131 for (
unsigned int i = 0; i < 2; i++)
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();