25 #include <gtest/gtest.h> 27 #include "../../include/ecl/containers/array.hpp" 28 #include "../../include/ecl/containers/stencil.hpp" 51 TEST(StencilTests,construction) {
60 EXPECT_EQ(2,stencil[0]);
61 EXPECT_EQ(3,stencil[1]);
62 EXPECT_EQ(4,stencil[2]);
63 EXPECT_EQ(7,dstencil[0]);
64 EXPECT_EQ(8,dstencil[1]);
65 EXPECT_EQ(9,dstencil[2]);
68 TEST(StencilTests,badConstruction) {
82 TEST(StencilTests,badIndexing) {
99 TEST(StencilTests,modifying) {
103 darray << 6,7,8,9,10;
106 EXPECT_EQ(1,stencil[0]);
107 EXPECT_EQ(2,stencil[1]);
109 EXPECT_EQ(2,stencil[0]);
110 EXPECT_EQ(3,stencil[1]);
111 EXPECT_EQ(4,stencil[2]);
112 EXPECT_EQ(5,stencil[3]);
126 TEST(StencilTests,byteStrings) {
128 std::string str(
"dude");
130 EXPECT_EQ(4,stencil.size());
131 EXPECT_EQ(
'd',stencil[0]);
132 EXPECT_EQ(
'u',stencil[1]);
133 EXPECT_EQ(
'd',stencil[2]);
134 EXPECT_EQ(
'e',stencil[3]);
142 TEST(StencilTests,unsignedCharArrays) {
145 unsigned char buffer[4];
147 stencil << 0xff, 0x00, 0x01, 0x02;
148 EXPECT_EQ(4,stencil.
size());
149 EXPECT_EQ(255,stencil[0]);
150 EXPECT_EQ(0,stencil[1]);
151 EXPECT_EQ(1,stencil[2]);
152 EXPECT_EQ(2,stencil[3]);
167 int main(
int argc,
char **argv) {
168 testing::InitGoogleTest(&argc,argv);
169 return RUN_ALL_TESTS();
Fixed size container with a few bells and whistles.
void resettle(const unsigned int &start_index, const unsigned int &n)
Resettle the stencil on a different range over the same underlying array.
Stencil< Array< int, 5 > > FixedStencil
Stencil< Array< char, 3 > > ByteStencil
Stencil< Array< Type, Size > > stencil(const unsigned int &start_index, const unsigned int &n)
Open a window (stencil) onto the array.
Array< char, 3 > ByteArray
int main(int argc, char **argv)
A safe windowing class that opens onto array-like containers.
#define ecl_compile_time_concept_check(Model)
Stencil< Array< int > > DynamicStencil
TEST(StencilTests, construction)