summaryrefslogtreecommitdiffstats
path: root/test/gdb/src/flat_segment_tree.cpp
blob: be4817e0325b4d57cdd41a39f8a1d322f587aa99 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Test code for mdds::flat_segment_tree.

   This file is part of mdds.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include <string>

#include <mdds/flat_segment_tree.hpp>

void stop();

using std::string;

using mdds::flat_segment_tree;

void test_flat_segment_tree()
{
    flat_segment_tree<int, int> default_fst(0, 100, 42);

    flat_segment_tree<int, int> fst_int(0, 100, 42);
    fst_int.insert_back(0, 20, 1);
    fst_int.insert_back(40, 60, 0);

    flat_segment_tree<int, string> fst_string(10, 50, "42");
    fst_string.insert_back(20, 30, "My hovercraft is full of eels");

    flat_segment_tree<int, int>::const_iterator fst_iter_singular;
    auto fst_iter1 = fst_int.begin();
    auto fst_iter2 = fst_iter1;
    ++fst_iter2;

    flat_segment_tree<int, int>::const_segment_iterator fst_seg_iter_singular;
    auto fst_seg_iter1 = fst_int.begin_segment();
    auto fst_seg_iter2 = fst_seg_iter1;
    ++fst_seg_iter2;

    stop();
}

// vim: set shiftwidth=4 softtabstop=4 expandtab: