summaryrefslogtreecommitdiff
path: root/tests/iterator.cpp
blob: 85037dae309120f8574b0b56afe6657b9208fc4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <forstio/test/suite.hpp>

#include "../c++/iterator.hpp"

#include <iostream>

namespace {
namespace sch {
using namespace kel::lbm::sch;
}

SAW_TEST("Iterate"){
	using namespace kel;

	saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
	saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}};

	lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
		std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
	}, start, end);
}

SAW_TEST("Iterate with Distance 1"){
	using namespace kel;

	saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
	saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}};

	lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
		std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
	}, start, end, {1u});
}
}