00001
00002
00003
00004 #include <syscall.h>
00005 #include "tests/lib.h"
00006 #include "tests/main.h"
00007
00008 void
00009 test_main (void)
00010 {
00011 int handle, byte_cnt;
00012 char buf;
00013
00014 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
00015
00016 buf = 123;
00017 byte_cnt = read (handle, &buf, 0);
00018 if (byte_cnt != 0)
00019 fail ("read() returned %d instead of 0", byte_cnt);
00020 else if (buf != 123)
00021 fail ("0-byte read() modified buffer");
00022 }