* devlist.c, test_devlist.c: Further tests revealed a bug,
corrected.
This commit is contained in:
parent
3194808fbe
commit
7fec58d953
|
|
@ -1,3 +1,9 @@
|
||||||
|
2000-07-08 Arno W. Peters <A.W.Peters@ieee.org>
|
||||||
|
|
||||||
|
* devlist.c, test-devlist: Additional checks revealed a bug,
|
||||||
|
first_device() and next_device() should now do what they are
|
||||||
|
supposed to do.
|
||||||
|
|
||||||
2000-07-07 Arno W. Peters <A.W.Peters@ieee.org>
|
2000-07-07 Arno W. Peters <A.W.Peters@ieee.org>
|
||||||
|
|
||||||
* devlist.c, devlist.h: Another step towards
|
* devlist.c, devlist.h: Another step towards
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,9 @@ next_device(SPICEdev **current)
|
||||||
int index;
|
int index;
|
||||||
SPICEdev **ret;
|
SPICEdev **ret;
|
||||||
|
|
||||||
index = (current - devices())/sizeof(SPICEdev *);
|
index = current - devices();
|
||||||
printf("index: %d\n", index);
|
|
||||||
if (index < num_devices()) {
|
if (index < num_devices()) {
|
||||||
ret = current + sizeof(SPICEdev *);
|
ret = current + 1;
|
||||||
} else {
|
} else {
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,18 +56,21 @@ main(void)
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
for (dev = first_device(); dev != NULL; dev = next_device(dev)) {
|
for (dev = first_device(); dev != NULL; dev = next_device(dev)) {
|
||||||
printf("count: %d\n", count);
|
if (*dev != DEVices[count]) {
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == num_devices() + 1) {
|
if (ret == EXIT_SUCCESS && count == num_devices() + 1) {
|
||||||
printf("PASSED");
|
printf("PASSED");
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
printf("FAILED");
|
printf("FAILED");
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
printf(": test_dev\n");
|
printf(": test_devlist\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue