MCPcopy Create free account
hub / github.com/acl-dev/acl / test_htable

Function test_htable

lib_acl_cpp/samples/benchmark/token_tree/main.cpp:68–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static void test_htable(int max)
69{
70 ACL_HTABLE* htable = acl_htable_create(100, 0);
71
72 for (int i = 0; tokens[i] != NULL; i++) {
73 acl_htable_enter(htable, tokens[i], (void*) tokens[i]);
74 }
75
76 acl::meter_time(__FUNCTION__, __LINE__, "begin\t");
77
78 int j = 0;
79 for (int i = 0; i < max; i++) {
80 const char* value = (const char*) acl_htable_find(htable, tokens[j]);
81 if (value == NULL) {
82 printf("find error, key=%s\r\n", tokens[j]);
83 break;
84 }
85 if (tokens[++j] == NULL) {
86 j = 0;
87 }
88 }
89
90 acl::meter_time(__FUNCTION__, __LINE__, "end\t");
91 acl_htable_free(htable, NULL);
92}
93
94static void test_stdmap(int max)
95{

Callers 1

mainFunction · 0.85

Calls 5

acl_htable_createFunction · 0.85
acl_htable_enterFunction · 0.85
meter_timeFunction · 0.85
acl_htable_findFunction · 0.85
acl_htable_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…