29 #if GWENHYWFAR_ENABLE_TESTCODE 93 for (i=0; i<100; i++) {
102 if (rv!=(int64_t) i) {
104 i, (
unsigned long) rv, i);
116 (
unsigned long) i, (
unsigned long)
id, (
unsigned long) i+1);
140 for (i=0; i<100; i++) {
165 (
unsigned long) i, (
unsigned long)
id, (
unsigned long) i+1);
195 (
unsigned long) i, (
unsigned long)
id, (
unsigned long) i+1);
225 for (i=0; i<2048; i++) {
231 "Error on GWEN_IdList64_AddEntry(%d): %s (%d)",
235 if (rv!=(int64_t)i) {
236 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
242 for (i=0; i<8; i++) {
243 GWEN_IDTABLE64 *table;
247 refCounter=table->refCount;
249 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list1) %d: is %d, should be 1 ", i, refCounter);
269 for (i=0; i<2048; i++) {
275 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
279 if (rv!=(int64_t)i) {
280 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
286 for (i=0; i<8; i++) {
287 GWEN_IDTABLE64 *table;
291 refCounter=table->refCount;
293 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list1) %d: is %d, should be 1 ", i, refCounter);
316 for (i=0; i<2048; i++) {
322 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
326 if (rv!=(int64_t)i) {
327 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
334 for (i=0; i<2048; i++) {
340 "Error on GWEN_IdList64_GetIdAt(%d, list1): %s (%d)",
344 if (entry != (int64_t)(i+1)) {
345 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
350 for (i=0; i<2048; i++) {
356 "Error on GWEN_IdList64_GetIdAt(%d, list2): %s (%d)",
360 if (entry != (int64_t)(i+1)) {
361 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
367 for (i=0; i<8; i++) {
368 GWEN_IDTABLE64 *table;
372 refCounter=table->refCount;
374 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list1) %d: is %d, should be 1 ", i, refCounter);
379 for (i=0; i<8; i++) {
380 GWEN_IDTABLE64 *table;
384 refCounter=table->refCount;
386 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list2) %d: is %d, should be 1 ", i, refCounter);
407 for (i=0; i<2048; i++) {
413 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
417 if (rv!=(int64_t)i) {
418 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
425 for (i=0; i<8; i++) {
426 GWEN_IDTABLE64 *table;
430 refCounter=table->refCount;
439 for (i=0; i<8; i++) {
440 GWEN_IDTABLE64 *table;
444 refCounter=table->refCount;
446 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list2) %d: is %d, should be 1 ", i, refCounter);
467 for (i=0; i<2048; i++) {
473 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
477 if (rv!=(int64_t)i) {
478 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
483 for (i=0; i<8; i++) {
484 GWEN_IDTABLE64 *table;
488 refCounter=table->refCount;
497 for (i=0; i<8; i++) {
498 GWEN_IDTABLE64 *table;
502 refCounter=table->refCount;
509 for (i=0; i<8; i++) {
510 GWEN_IDTABLE64 *table1;
511 GWEN_IDTABLE64 *table2;
515 if (table1!=table2) {
525 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
529 if (iEntry!=(int64_t)2048) {
530 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be 2048", i, (
unsigned long) iEntry);
547 for (i=0; i<8; i++) {
548 GWEN_IDTABLE64 *table;
552 refCounter=table->refCount;
559 for (i=0; i<8; i++) {
560 GWEN_IDTABLE64 *table;
564 refCounter=table->refCount;
571 for (i=8; i<9; i++) {
572 GWEN_IDTABLE64 *table;
576 refCounter=table->refCount;
596 for (i=0; i<2048; i++) {
602 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
606 if (rv!=(int64_t)i) {
607 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
614 for (i=2048; i<4096; i++) {
620 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
624 if (rv!=(int64_t)i) {
625 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
631 for (i=0; i<2048; i++) {
637 "Error on GWEN_IdList64_GetIdAt(%d, list1): %s (%d)",
641 if (entry != (int64_t)(i+1)) {
642 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
652 for (i=0; i<4096; i++) {
658 "Error on GWEN_IdList64_GetIdAt(%d, list2): %s (%d)",
662 if (entry != (int64_t)(i+1)) {
663 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
674 for (i=0; i<8; i++) {
675 GWEN_IDTABLE64 *table;
679 refCounter=table->refCount;
686 for (i=0; i<8; i++) {
687 GWEN_IDTABLE64 *table;
691 refCounter=table->refCount;
698 for (i=8; i<16; i++) {
699 GWEN_IDTABLE64 *table;
703 refCounter=table->refCount;
713 for (i=0; i<(2048/256); i++) {
714 GWEN_IDTABLE64 *table;
718 refCounter=table->refCount;
720 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list2) %d: is %d, should be 1 ", i, refCounter);
739 for (i=0; i<2047; i++) {
745 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
749 if (rv!=(int64_t)i) {
750 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
755 for (i=0; i<8; i++) {
756 GWEN_IDTABLE64 *table;
760 refCounter=table->refCount;
772 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
776 if (rv!=(int64_t)2047) {
777 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be 2047", i, (
unsigned long) rv);
793 for (i=0; i<8; i++) {
794 GWEN_IDTABLE64 *table;
798 refCounter=table->refCount;
805 for (i=0; i<8; i++) {
806 GWEN_IDTABLE64 *table;
810 refCounter=table->refCount;
817 for (i=8; i<8; i++) {
818 GWEN_IDTABLE64 *table;
822 refCounter=table->refCount;
842 for (i=0; i<2048; i++) {
848 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
852 if (rv!=(int64_t)i) {
853 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
860 for (i=0; i<2048; i++) {
866 "Error on GWEN_IdList64_GetIdAt(%d, list1): %s (%d)",
870 if (entry != (int64_t)(i+1)) {
871 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
876 for (i=0; i<2048; i++) {
882 "Error on GWEN_IdList64_GetIdAt(%d, list2): %s (%d)",
886 if (entry != (int64_t)(i+1)) {
887 DBG_ERROR(
GWEN_LOGDOMAIN,
"Non-matching entry at index %d: is %ld, should be %d ", i, (
unsigned long) entry, i);
893 for (i=0; i<8; i++) {
894 GWEN_IDTABLE64 *table;
898 refCounter=table->refCount;
900 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list1) %d: is %d, should be 1 ", i, refCounter);
905 for (i=0; i<8; i++) {
906 GWEN_IDTABLE64 *table;
910 refCounter=table->refCount;
912 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected reference counter in table (list2) %d: is %d, should be 1 ", i, refCounter);
934 for (i=0; i<2048; i++) {
940 "Error on GWEN_IdList64_AddId(%d): %s (%d)",
944 if (rv!=(int64_t)i) {
945 DBG_ERROR(
GWEN_LOGDOMAIN,
"Unexpected index returned for entry %d: is %ld, should be %d ", i, (
unsigned long) rv, i);
953 rv=_compareList1AgainstList2(ptrList1, ptrList2);
983 while (id1>0 && id2>0) {
985 fprintf(stderr,
"Tables differ at position %lu (%lu != %lu)\n",
986 (
unsigned long) index,
988 (
unsigned long) id2);
998 fprintf(stderr,
"NUmber of elements in lists differs\n");
int test10(int argc, char **argv)
int test5(int argc, char **argv)
int test3(int argc, char **argv)
GWEN_IDLIST64_ITERATOR * GWEN_IdList64_Iterator_new(GWEN_IDLIST64 *idl)
GWEN_IDLIST64 * GWEN_IdList64_dup(const GWEN_IDLIST64 *oldList)
int test6(int argc, char **argv)
int test9(int argc, char **argv)
int test2(int argc, char **argv)
int GWEN_IdList64_Sort(GWEN_IDLIST64 *idl)
void GWEN_IdList64_free(GWEN_IDLIST64 *idl)
static GWEN_IDTABLE64 * GWEN_IdList64_GetTableAt(const GWEN_IDLIST64 *tl, uint64_t idx)
void GWEN_IdList64_Iterator_free(GWEN_IDLIST64_ITERATOR *it)
GWEN_IDLIST64 * GWEN_IdList64_newWithSteps(uint64_t steps)
GWEN_TEST_MODULE * GWEN_Test_Module_AddTest(GWEN_TEST_MODULE *st, const char *tName, GWEN_TEST_MODULE_TEST_FN fn, const char *tDescr)
int test8(int argc, char **argv)
GWEN_SIMPLEPTRLIST GWEN_IDLIST64
int64_t GWEN_IdList64_GetIdAt(const GWEN_IDLIST64 *idl, uint64_t idx)
uint64_t GWEN_IdList64_Iterator_GetFirstId(GWEN_IDLIST64_ITERATOR *it)
struct GWEN_TEST_MODULE GWEN_TEST_MODULE
#define GWEN_ERROR_GENERIC
#define DBG_ERROR(dbg_logger, format, args...)
int test7(int argc, char **argv)
int GWEN_IdList64_AddTests(GWEN_TEST_MODULE *mod)
GWEN_IDLIST64 * GWEN_IdList64_LazyCopy(GWEN_IDLIST64 *oldList)
int test4(int argc, char **argv)
int test11(int argc, char **argv)
uint64_t GWEN_IdList64_Iterator_GetNextId(GWEN_IDLIST64_ITERATOR *it)
#define GWEN_ERROR_INTERNAL
GWEN_TEST_MODULE * GWEN_Test_Module_AddModule(GWEN_TEST_MODULE *st, const char *tName, const char *tDescr)
struct GWEN_IDLIST64_ITERATOR GWEN_IDLIST64_ITERATOR
int64_t GWEN_IdList64_AddId(GWEN_IDLIST64 *idl, uint64_t entry)
int GWEN_IdList64_ReverseSort(GWEN_IDLIST64 *idl)
const char * GWEN_Error_SimpleToString(int i)
Returns a (very) short string describing the given GWEN error code, or "Unknown error" for unknown co...