From 88ba93c1b7584df1c31ccc33f8a8460ac7251a8d Mon Sep 17 00:00:00 2001 From: jmcmullan Date: Wed, 14 Sep 2011 21:12:13 +0000 Subject: [PATCH] Tests/dos/readitem: Add edge case where the buffersize is -1 Signed-off-by: Jason S. McMullan git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@41351 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- test/dos/readitem.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/dos/readitem.c b/test/dos/readitem.c index 1a0a546bb1..31b519f77c 100644 --- a/test/dos/readitem.c +++ b/test/dos/readitem.c @@ -225,8 +225,28 @@ int main(int argc, char **argv) failed += lfailed; } + { + int lfailed = 0; + LONG ioerr; + BPTR oldio; + BYTE buff[] = { 0x11, 0x22, 0x33, 0x44 }; - + oldio = Input(); + SelectInput(BNULL); + SetIoErr(IOERR_UNCHANGED); + ret = ReadItem(buff, -1, NULL); + ioerr = IoErr(); + SelectInput(oldio); + tests++; + lfailed |= (ret != ITEM_NOTHING) ? 1 : 0; + lfailed |= (ioerr != IOERR_UNCHANGED) ? 1 : 0; + lfailed |= (buff[0] != 0x0) ? 1 : 0; + if (lfailed) { + Printf("Edge5: expected %ld (%ld), buff[0] = 0x00\n", ITEM_NOTHING, IOERR_UNCHANGED); + Printf("Edge5: returned %ld (%ld), buff[0] = 0x%02lx\n", ret, ioerr, (LONG)buff[0]); + } + failed += lfailed; + } if (failed == 0) Printf("All %ld tests passed\n", tests); -- 2.11.4.GIT