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

Function test

lib_acl_cpp/samples/dbuf/dbuf4/main.cpp:33–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33static void test(int nblock, int capacity, int incr, int max, int pos)
34{
35 acl::dbuf_guard dbuf((size_t) nblock, (size_t) capacity);
36 dbuf.set_increment((size_t) incr);
37 myobj* o;
38
39 for (int i = 0; i < max; i++)
40 {
41 o = dbuf.create<myobj>(&dbuf, i);
42 if (i < 10)
43 o->run();
44 }
45
46 o = (myobj*) dbuf.get((size_t) pos);
47 if (o == NULL)
48 printf("get: %d NULL\r\n", pos);
49 else if (o->get() != pos)
50 printf("get: %d != %d\r\n", o->get(), pos);
51 else
52 printf("ok, max: %d, pos: %d\r\n", max, pos);
53
54 printf("----------------Again---------------\r\n");
55 dbuf.dbuf_reset();
56
57 for (int i = 0; i < max; i++)
58 {
59 o = dbuf.create<myobj>(&dbuf, i);
60 if (i < 10)
61 o->run();
62 }
63
64 o = (myobj*) dbuf.get((size_t) pos);
65 if (o == NULL)
66 printf("get: %d NULL\r\n", pos);
67 else if (o->get() != pos)
68 printf("get: %d != %d\r\n", o->get(), pos);
69 else
70 printf("ok, max: %d, pos: %d\r\n", max, pos);
71
72}
73
74static void usage(const char* procname)
75{

Callers 1

mainFunction · 0.70

Calls 4

set_incrementMethod · 0.80
dbuf_resetMethod · 0.80
runMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…