Embedded Artistry Framework
Embedded Systems C++ Framework
Functions | Variables
qsort.c File Reference
#include "stdlib_tests.h"
#include <stdlib.h>
#include <string.h>
#include <test/test.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <cmocka.h>
Include dependency graph for qsort.c:

Functions

static int scmp (const void *a, const void *b)
 
static int icmp (const void *a, const void *b)
 
static int ccmp (const void *a, const void *b)
 
static int cmp64 (const void *a, const void *b)
 
static void qsort_string_test (void **state)
 
static void qsort_int_test (void **state)
 
static void char_test (const char *a, const char *a_sorted, void **state)
 
static void qsort_char_test (void **state)
 
static void uint64_gen (uint64_t *p, uint64_t *p_sorted, size_t num)
 
static void uint64_test (uint64_t *a, uint64_t *a_sorted, size_t len, void **state)
 
static void qsort_uint64_test (void **state)
 
int qsort_tests (void)
 

Variables

static const char * s []
 
static const char * s_sorted []
 
static int n []
 
static int n_sorted []
 

Function Documentation

◆ ccmp()

static int ccmp ( const void *  a,
const void *  b 
)
static

References a, and b.

Referenced by char_test().

◆ char_test()

static void char_test ( const char *  a,
const char *  a_sorted,
void **  state 
)
static

References a, ccmp(), free(), malloc(), memcmp(), p, qsort(), strcpy(), and strlen().

Referenced by qsort_char_test().

◆ cmp64()

static int cmp64 ( const void *  a,
const void *  b 
)
static

References a, and b.

Referenced by uint64_test().

◆ icmp()

static int icmp ( const void *  a,
const void *  b 
)
static

References a, and b.

Referenced by qsort_int_test().

◆ qsort_char_test()

static void qsort_char_test ( void **  state)
static

References char_test().

Referenced by qsort_tests().

◆ qsort_int_test()

static void qsort_int_test ( void **  state)
static

References icmp(), n, n_sorted, and qsort().

Referenced by qsort_tests().

◆ qsort_string_test()

static void qsort_string_test ( void **  state)
static

References qsort(), s, s_sorted, scmp(), and strcmp().

Referenced by qsort_tests().

◆ qsort_tests()

int qsort_tests ( void  )

References NULL, qsort_char_test(), qsort_int_test(), qsort_string_test(), qsort_tests(), and qsort_uint64_test().

Referenced by qsort_tests(), and stdlib_tests().

Here is the caller graph for this function:

◆ qsort_uint64_test()

static void qsort_uint64_test ( void **  state)
static

References p, uint64_gen(), and uint64_test().

Referenced by qsort_tests().

◆ scmp()

static int scmp ( const void *  a,
const void *  b 
)
static

References a, b, and strcmp().

Referenced by qsort_string_test().

◆ uint64_gen()

static void uint64_gen ( uint64_t p,
uint64_t p_sorted,
size_t  num 
)
static

◆ uint64_test()

static void uint64_test ( uint64_t a,
uint64_t a_sorted,
size_t  len,
void **  state 
)
static

References a, cmp64(), and qsort().

Referenced by qsort_uint64_test().

Variable Documentation

◆ n

int n[]
static
Initial value:
= {879045, 394, 99405644, 33434, 232323, 4334, 5454, 343,
45545, 454, 324, 22, 34344, 233, 45345, 343,
848405, 3434, 3434344, 3535, 93994, 2230404, 4334}

Referenced by _qsort(), qsort(), qsort_int_test(), and swapfunc().

◆ n_sorted

int n_sorted[]
static
Initial value:
= {22, 233, 324, 343, 343, 394, 454, 3434,
3535, 4334, 4334, 5454, 33434, 34344, 45345, 45545,
93994, 232323, 848405, 879045, 2230404, 3434344, 99405644}

Referenced by qsort_int_test().

◆ s

const char* s[]
static
Initial value:
= {"Bob", "Alice", "John", "Ceres", "Helga", "Drepper", "Emeralda",
"Zoran", "Momo", "Frank", "Pema", "Xavier", "Yeva", "Gedun",
"Irina", "Nono", "Wiener", "Vincent", "Tsering", "Karnica", "Lulu",
"Quincy", "Osama", "Riley", "Ursula", "Sam"}

Referenced by qsort_string_test().

◆ s_sorted

const char* s_sorted[]
static
Initial value:
= {
"Alice", "Bob", "Ceres", "Drepper", "Emeralda", "Frank", "Gedun", "Helga", "Irina",
"John", "Karnica", "Lulu", "Momo", "Nono", "Osama", "Pema", "Quincy", "Riley",
"Sam", "Tsering", "Ursula", "Vincent", "Wiener", "Xavier", "Yeva", "Zoran"}

Referenced by qsort_string_test().