| 31 | }; |
| 32 | |
| 33 | static 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 | |
| 74 | static void usage(const char* procname) |
| 75 | { |
no test coverage detected
searching dependent graphs…