X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fuserprog%2Fread-boundary.c;h=41c798ea7f06302785e85dab5471edcaf10e447d;hb=53c6e81d1cff87ffccfca368adcca8b092f2a0d1;hp=799273093239f6a77ff2074e4b43efb8e547cede;hpb=ab65396546f21401105c34f5700cda0dae304e8d;p=pintos-anon diff --git a/grading/userprog/read-boundary.c b/grading/userprog/read-boundary.c index 7992730..41c798e 100644 --- a/grading/userprog/read-boundary.c +++ b/grading/userprog/read-boundary.c @@ -2,15 +2,7 @@ #include #include #include - -char expected[] = { - "Amazing Electronic Fact: If you scuffed your feet long enough without\n" - "touching anything, you would build up so many electrons that your\n" - "finger would explode! But this is nothing to worry about unless you\n" - "have carpeting.\n" -}; - - +#include "sample.inc" static char * mk_boundary_string (const char *src) @@ -28,7 +20,7 @@ main (void) int byte_cnt; char *actual_p; - actual_p = mk_boundary_string (expected); + actual_p = mk_boundary_string (sample); printf ("(read-boundary) begin\n"); @@ -36,11 +28,11 @@ main (void) if (handle < 2) printf ("(read-boundary) fail: open() returned %d\n", handle); - byte_cnt = read (handle, actual_p, sizeof expected - 1); - if (byte_cnt != sizeof expected - 1) + byte_cnt = read (handle, actual_p, sizeof sample - 1); + if (byte_cnt != sizeof sample - 1) printf ("(read-boundary) fail: read() returned %d instead of %d\n", - byte_cnt, sizeof expected - 1); - else if (strcmp (expected, actual_p)) + byte_cnt, sizeof sample - 1); + else if (strcmp (sample, actual_p)) printf ("(read-boundary) fail: expected text differs from actual:\n%s", actual_p);