File: judy_test.cpp

package info (click to toggle)
wikidiff2 1.2%2Bgit03ea59f-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 276 kB
  • ctags: 240
  • sloc: cpp: 1,357; php: 172; makefile: 13
file content (35 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (8)
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
#include <iostream>
#include "JudyHS.h"

using namespace std;

int main(int argc, char** argv)
{
	JudyHS<string> a;
	a["one"] = "1";
	a["two"] = "2";
	a["three"] = "3";
	cout << a["one"] << " " << a["two"] << " " << a["three"] << endl;

	cout << "Memleak test: add/delete" << endl;
	for (int i=0; i<1000000; i++) {
		a["test"] = "test";
		a.Delete("test");
	}

	cout << "Memleak test: add/add" << endl;
	for (int i=0; i<1000000; i++) {
		a["test"] = "test";
	}

	cout << "Memleak test: FreeArray" << endl;
	
	for (int i=0; i<1000000; i++) {
		JudyHS<string> b;
		b["Hello"] = "test";
	}
	cout << "Done, exiting" << endl;
	
	return 0;
}