#include <debug.h>
#include <limits.h>
#include <random.h>
#include <stdlib.h>
#include <stdio.h>
#include "threads/test.h"
Go to the source code of this file.
◆ MAX_CNT
Test program for sorting and searching in lib/stdlib.c.
Attempts to test the sorting and searching 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 an array that we will test.
Definition at line 19 of file stdlib.c.
◆ compare_ints()
static int compare_ints |
( |
const void * |
a_, |
|
|
const void * |
b_ |
|
) |
| |
|
static |
Returns 1 if *A is greater than *B, 0 if *A equals *B, -1 if *A is less than *B.
Definition at line 78 of file stdlib.c.
Referenced by test(), and verify_bsearch().
◆ shuffle() [1/2]
static void shuffle |
( |
int * |
array, |
|
|
size_t |
cnt |
|
) |
| |
|
static |
Shuffles the CNT elements in ARRAY into random order.
Definition at line 61 of file stdlib.c.
References random_ulong().
◆ shuffle() [2/2]
static void shuffle |
( |
int |
[], |
|
|
size_t |
|
|
) |
| |
|
static |
◆ test()
◆ verify_bsearch() [1/2]
static void verify_bsearch |
( |
const int * |
array, |
|
|
size_t |
cnt |
|
) |
| |
|
static |
◆ verify_bsearch() [2/2]
static void verify_bsearch |
( |
const int |
[], |
|
|
size_t |
|
|
) |
| |
|
static |
◆ verify_order() [1/2]
static void verify_order |
( |
const int * |
array, |
|
|
size_t |
cnt |
|
) |
| |
|
static |
Verifies that ARRAY contains the CNT ints 0...CNT-1.
Definition at line 88 of file stdlib.c.
References ASSERT.
◆ verify_order() [2/2]
static void verify_order |
( |
const int |
[], |
|
|
size_t |
|
|
) |
| |
|
static |