PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
#include <debug.h>
#include <list.h>
#include <random.h>
#include <stdio.h>
#include "threads/test.h"
Go to the source code of this file.
Data Structures | |
struct | value |
A linked list element. More... | |
Macros | |
#define | MAX_SIZE 64 |
Test program for lib/kernel/list.c. More... | |
Functions | |
static void | shuffle (struct value[], size_t) |
static bool | value_less (const struct list_elem *, const struct list_elem *, void *) |
static void | verify_list_fwd (struct list *list, int size) |
Verifies that LIST contains the values 0...SIZE when traversed in forward order. More... | |
static void | verify_list_bkwd (struct list *list, int size) |
Verifies that LIST contains the values 0...SIZE when traversed in reverse order. More... | |
void | test (void) |
Test the linked list implementation. More... | |
static void | shuffle (struct value *array, size_t cnt) |
Shuffles the CNT elements in ARRAY into random order. More... | |
static bool | value_less (const struct list_elem *a_, const struct list_elem *b_, void *aux UNUSED) |
Returns true if value A is less than value B, false otherwise. More... | |
#define MAX_SIZE 64 |
Test program for lib/kernel/list.c.
Attempts to test the list functionality that is not sufficiently tested elsewhere in Pintos.
This is not a test we will run on your submitted projects. It is here for completeness. Maximum number of elements in a linked list that we will test.
Shuffles the CNT elements in ARRAY into random order.
Definition at line 113 of file list.c.
References random_ulong().
void test | ( | void | ) |
Test the linked list implementation.
Definition at line 36 of file list.c.
References ASSERT, value::elem, list_begin(), list_end(), list_entry, list_init(), list_insert(), list_insert_ordered(), list_max(), list_min(), list_next(), list_push_back(), list_reverse(), list_sort(), list_unique(), MAX_SIZE, NULL, printf(), random_ulong(), shuffle(), value::value, value_less(), verify_list_bkwd(), and verify_list_fwd().
Referenced by test_sleep().
|
static |
Returns true if value A is less than value B, false otherwise.
Definition at line 129 of file list.c.
References value::elem, list_entry, and value::value.
|
static |
Verifies that LIST contains the values 0...SIZE when traversed in reverse order.
Definition at line 160 of file list.c.
References ASSERT, value::elem, list_entry, list_prev(), list_rbegin(), list_rend(), and value::value.
Referenced by test().
|
static |
Verifies that LIST contains the values 0...SIZE when traversed in forward order.
Definition at line 141 of file list.c.
References ASSERT, value::elem, list_begin(), list_end(), list_entry, list_next(), and value::value.
Referenced by test().