Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / userprog / write-zero.c
1 #include <syscall.h>
2 #include "tests/lib.h"
3 #include "tests/main.h"
4
5 void
6 test_main (void) 
7 {
8   int handle, byte_cnt;
9   char buf;
10
11   CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
12
13   buf = 123;
14   byte_cnt = write (handle, &buf, 0);
15   if (byte_cnt != 0)
16     fail("write() returned %d instead of 0", byte_cnt);
17 }