test-coffee: Fix numbering of test failure cases

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
Benoît Thébaudeau 2016-05-29 22:01:40 +02:00
parent 5d227b92a3
commit 76429e4f0e

View File

@ -136,15 +136,15 @@ coffee_test_basic(void)
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
r = cfs_read(rfd, buf, sizeof(buf)); r = cfs_read(rfd, buf, sizeof(buf));
if(r < 0) { if(r < 0) {
TEST_FAIL(14); TEST_FAIL(13);
} else if(r < sizeof(buf)) { } else if(r < sizeof(buf)) {
TEST_FAIL(15); TEST_FAIL(14);
} }
/* Test 16: Verify that the data is correct. */ /* Test 16: Verify that the data is correct. */
for(r = 0; r < sizeof(buf); r++) { for(r = 0; r < sizeof(buf); r++) {
if(buf[r] != r) { if(buf[r] != r) {
TEST_FAIL(16); TEST_FAIL(15);
} }
} }
@ -153,16 +153,16 @@ coffee_test_basic(void)
buf[r] = sizeof(buf) - r - 1; buf[r] = sizeof(buf) - r - 1;
} }
if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) { if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) {
TEST_FAIL(17); TEST_FAIL(16);
} }
r = cfs_write(wfd, buf, sizeof(buf)); r = cfs_write(wfd, buf, sizeof(buf));
if(r < 0) { if(r < 0) {
TEST_FAIL(18); TEST_FAIL(17);
} else if(r < sizeof(buf)) { } else if(r < sizeof(buf)) {
TEST_FAIL(19); TEST_FAIL(18);
} }
if(cfs_seek(rfd, 0, CFS_SEEK_SET) != 0) { if(cfs_seek(rfd, 0, CFS_SEEK_SET) != 0) {
TEST_FAIL(20); TEST_FAIL(19);
} }
/* Test 21 and 22: Read the reversed buffer. */ /* Test 21 and 22: Read the reversed buffer. */
@ -170,16 +170,16 @@ coffee_test_basic(void)
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
r = cfs_read(rfd, buf, sizeof(buf)); r = cfs_read(rfd, buf, sizeof(buf));
if(r < 0) { if(r < 0) {
TEST_FAIL(21); TEST_FAIL(20);
} else if(r < sizeof(buf)) { } else if(r < sizeof(buf)) {
printf("r = %d\n", r); printf("r = %d\n", r);
TEST_FAIL(22); TEST_FAIL(21);
} }
/* Test 23: Verify that the data is correct. */ /* Test 23: Verify that the data is correct. */
for(r = 0; r < sizeof(buf); r++) { for(r = 0; r < sizeof(buf); r++) {
if(buf[r] != sizeof(buf) - r - 1) { if(buf[r] != sizeof(buf) - r - 1) {
TEST_FAIL(23); TEST_FAIL(22);
} }
} }