X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fthreads%2Flist.c;h=2300bc353f170e4ec4287adbd1b597101ce22e47;hb=2d20cd50c41c87a90d49e4b7ace3d18b8fb34f23;hp=aac583f8bb2b1fd1403856c0a1270922b1fcffdc;hpb=2e2a6414933167456860f7dac8c52d14b25d4821;p=pintos-anon diff --git a/src/tests/threads/list.c b/src/tests/threads/list.c index aac583f..2300bc3 100644 --- a/src/tests/threads/list.c +++ b/src/tests/threads/list.c @@ -41,7 +41,7 @@ test (void) { int repeat; - printf (" %zu", size); + printf (" %d", size); for (repeat = 0; repeat < 10; repeat++) { static struct value values[MAX_SIZE * 4]; @@ -59,6 +59,14 @@ test (void) for (i = 0; i < size; i++) list_push_back (&list, &values[i].elem); + /* Verify correct minimum and maximum elements. */ + e = list_min (&list, value_less, NULL); + ASSERT (size ? list_entry (e, struct value, elem)->value == 0 + : e == list_begin (&list)); + e = list_max (&list, value_less, NULL); + ASSERT (size ? list_entry (e, struct value, elem)->value == size - 1 + : e == list_begin (&list)); + /* Sort and verify list. */ list_sort (&list, value_less, NULL); verify_list_fwd (&list, size); @@ -96,6 +104,7 @@ test (void) } printf (" done\n"); + printf ("list: PASS\n"); } /* Shuffles the CNT elements in ARRAY into random order. */