1
/******************************************************************************
2
* Copyright © 2012-2014 Institut für Nachrichtentechnik, Universität Rostock *
3
* Copyright © 2006-2012 Quality & Usability Lab, *
4
* Telekom Innovation Laboratories, TU Berlin *
6
* This file is part of the Audio Processing Framework (APF). *
8
* The APF is free software: you can redistribute it and/or modify it under *
9
* the terms of the GNU General Public License as published by the Free *
10
* Software Foundation, either version 3 of the License, or (at your option) *
11
* any later version. *
13
* The APF is distributed in the hope that it will be useful, but WITHOUT ANY *
14
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
15
* FOR A PARTICULAR PURPOSE. *
16
* See the GNU General Public License for more details. *
18
* You should have received a copy of the GNU General Public License along *
19
* with this program. If not, see <http://www.gnu.org/licenses/>. *
21
* http://AudioProcessingFramework.github.com *
22
******************************************************************************/
24
// Tests for combinations of different iterators.
26
#include "apf/iterator.h" // for *_iterator
28
#include "catch/catch.hpp"
32
float operator()(int in) { return static_cast<float>(in) * 1.5f; }
35
using ii = apf::index_iterator<int>;
36
using fii = apf::transform_iterator<ii, three_halves>;
37
using si = apf::stride_iterator<ii>;
38
using fsi = apf::transform_iterator<si, three_halves>;
40
TEST_CASE("iterators/combinations", "Test combinations of iterators")
43
SECTION("index_iterator + transform_iterator", "")
45
auto iter = fii(apf::make_index_iterator(2), three_halves());
49
SECTION("index_iterator + stride_iterator + transform_iterator", "")
51
auto iter = fsi(si(apf::make_index_iterator(2), 2), three_halves());
56
auto iter2 = fsi(si(apf::make_index_iterator(2), -2), three_halves());
57
CHECK(*iter2 == 3.0f);
59
CHECK(*iter2 == 0.0f);
65
// Settings for Vim (http://www.vim.org/), please do not remove:
66
// vim:softtabstop=2:shiftwidth=2:expandtab:textwidth=80:cindent