LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
viewstest.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "viewstest.h"
10#include <QtTest>
11#include <views.h>
12#include <prelude.h>
13
14QTEST_MAIN (LC::Util::ViewsTest)
15
16namespace LC
17{
18namespace Util
19{
20 void ViewsTest::testZipView ()
21 {
22 QList<int> ints { 1, 2, 3 };
23 QList<QString> strings { "a", "b", "c" };
24
26 for (const auto& pair : Views::Zip (ints, strings))
27 pairs << pair;
28
29 QCOMPARE (pairs, (Zip (ints, strings)));
30 }
31
32 void ViewsTest::testZipViewDifferentLengths ()
33 {
34 QList<int> ints { 1, 2, 3, 4, 5 };
35 QList<QString> strings { "a", "b", "c" };
36
38 for (const auto& pair : Views::Zip (ints, strings))
39 pairs << pair;
40
41 QCOMPARE (pairs, (Zip (ints, strings)));
42 }
43}
44}
detail::ZipRange< typename C1::const_iterator, typename C2::const_iterator, PairType > Zip(const C1 &c1, const C2 &c2)
Definition: views.h:108
auto Zip(const Container< T1 > &c1, const Container< T2 > &c2) -> Container< Pair< T1, T2 > >
Definition: prelude.h:60
Definition: constants.h:15