Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
test-coll.hpp
Go to the documentation of this file.
1/*
2 TEST-COLL.hpp - containers and collections with test data
3
4 Copyright (C)
5 2010, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
20#ifndef LIB_TEST_TEST_COLL_H
21#define LIB_TEST_TEST_COLL_H
22
23
24#include <unordered_map>
25#include <iostream>
26#include <vector>
27#include <map>
28
29
30namespace lib {
31namespace test{
32
33
34 typedef std::vector<int> VecI;
35
36 template<class VEC>
37 inline VEC
38 getTestSeq_int (const uint NUM_ELMS)
39 {
40 VEC vec;
41 for (uint i=0; i<NUM_ELMS; ++i)
42 vec.push_back (i);
43
44 return vec;
45 }
46
47
48 typedef std::map<int,int> MapII;
49 typedef std::multimap<int,int> MMapII;
50
51 typedef std::unordered_map<int,int> HMapII;
52 typedef std::unordered_multimap<int,int> HMMapII;
53
54
55 template<class MAP>
56 inline MAP
57 getTestMap_int (const uint NUM_ELMS)
58 {
59 MAP map;
60 for (uint i=0; i<NUM_ELMS; ++i)
61 map[i] = 2*i;
62
63 return map;
64 }
65
66 template<class MUMAP>
67 inline MUMAP
68 getTestMultiMap_int (const uint NUM_ELMS)
69 {
70 MUMAP map;
71 for (uint i=0; i<NUM_ELMS; ++i)
72 for (uint j=NUM_ELMS-i; j; --j)
73 map.insert (std::make_pair (i, j));
74
75 return map;
76 }
77
78
79
80 template<class ITER>
81 inline void
82 pullOut (ITER const& i)
83 {
84 for (ITER ii(i); ii ; ++ii )
85 std::cout << "::" << *ii;
86 }
87
88
89
90}} // namespace lib::test
91#endif /*LIB_TEST_TEST_COLL_H*/
unsigned int uint
Definition integral.hpp:29
MAP getTestMap_int(const uint NUM_ELMS)
Definition test-coll.hpp:57
std::map< int, int > MapII
Definition test-coll.hpp:48
void pullOut(ITER const &i)
Definition test-coll.hpp:82
std::vector< int > VecI
Definition test-coll.hpp:34
MUMAP getTestMultiMap_int(const uint NUM_ELMS)
Definition test-coll.hpp:68
std::multimap< int, int > MMapII
Definition test-coll.hpp:49
VEC getTestSeq_int(const uint NUM_ELMS)
Definition test-coll.hpp:38
std::unordered_multimap< int, int > HMMapII
Definition test-coll.hpp:52
std::unordered_map< int, int > HMapII
Definition test-coll.hpp:51
Implementation namespace for support and library code.
Test runner and basic definitions for tests.