From 3867fa0e1b1dec1df9a41507b9b949385bc5a9a1 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Sat, 15 Sep 2012 12:22:44 +0200 Subject: [PATCH] added another test for fnu --- ImageStreams/main.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ImageStreams/main.cpp b/ImageStreams/main.cpp index bd28338..ab2a082 100644 --- a/ImageStreams/main.cpp +++ b/ImageStreams/main.cpp @@ -57,6 +57,27 @@ void test3(std::string filename){ image << typename ImageType::pixel(nice_rand()); } +template +void test4(std::string filename){ + size_t width = 1024; + size_t height = 768; + + std::vector r1(width, 0); + std::vector r2(width, 0); + + r1[width/2] = 1; + + ImageType image(width, height, filename); + for(int y = 0; y < height; ++y){ + for(auto x : r1) image << typename ImageType::pixel((double)x); + + r1.swap(r2); + for(int x = 1; x < width-1; ++x){ + r1[x] = (r2[x-1] || r2[x] || r2[x+1]) && !(r2[x-1] && r2[x] && r2[x+1]); + } + } +} + int main(int argc, const char * argv[]){ test>("test.png"); test>("test.bmp"); @@ -66,5 +87,8 @@ int main(int argc, const char * argv[]){ test3>("test_3.png"); test3>("test_3.bmp"); + + test4>("test_4.png"); + test4>("test_4.bmp"); }