File: sorted_node_store.test.cpp

package info (click to toggle)
tilemaker 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 78,284 kB
  • sloc: cpp: 28,715; ansic: 4,052; makefile: 180; ruby: 77; sh: 6
file content (41 lines) | stat: -rw-r--r-- 880 bytes parent folder | download
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
#include <iostream>
#include "external/minunit.h"
#include "sorted_node_store.h"

MU_TEST(test_sorted_node_store) {
	bool compressed = true;

	for (int i = 0; i < 2; i++) {
		compressed = !compressed;
		SortedNodeStore s1(compressed), s2(compressed);
		mu_check(s1.size() == 0);
		mu_check(s2.size() == 0);

		s1.batchStart();
		s2.batchStart();

		s1.insert({ {1, {2, 3 } } });
		s2.insert({ {2, {3, 4 } } });

		s1.finalize(1);
		s2.finalize(1);

		mu_check(s1.size() == 1);
		mu_check(s1.at(1) == LatpLon({2, 3}));
		mu_check(s1.contains(0, 1));
		mu_check(!s1.contains(0, 2));
		mu_check(!s1.contains(0, 1ull << 34));
		mu_check(s2.size() == 1);
		mu_check(s2.at(2) == LatpLon({3, 4}));
	}
}

MU_TEST_SUITE(test_suite_sorted_node_store) {
	MU_RUN_TEST(test_sorted_node_store);
}

int main() {
	MU_RUN_SUITE(test_suite_sorted_node_store);
	MU_REPORT();
	return MU_EXIT_CODE;
}