pelib  2.0.0
src/test_stack.c File Reference
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <pthread.h>
#include <pelib/unit.h>
#include <pelib/complex.h>
Include dependency graph for test_stack.c:

Go to the source code of this file.

Classes

struct  thread_parallel_pushpop_arg
struct  thread_aba_arg

Defines

#define MAX_PUSH_POP   10
#define NB_THREADS   2
#define test_run(test)
#define DATA_REAL   10
#define DATA_IM   12
#define DATA_SIZE   sizeof(complex_t)
#define debug_str(var)   printf("[%s:%s:%d] %s = \"%s\"\n", __FILE__, __FUNCTION__, __LINE__, #var, var);
#define debug_int(var)   printf("[%s:%s:%d] %s = %d\n", __FILE__, __FUNCTION__, __LINE__, #var, var);
#define debug_size_t(var)   printf("[%s:%s:%d] %s = %zu\n", __FILE__, __FUNCTION__, __LINE__, #var, var);

Typedefs

typedef struct
thread_parallel_pushpop_arg 
thread_parallel_pushpop_arg_t
typedef struct thread_aba_arg thread_aba_arg_t

Functions

 stack_t (complex_t)
void init ()
void cleanup ()
void teardown ()
void test_push ()
void test_peek ()
void test_pop ()
void test_push_safe ()
void test_pop_safe ()
void test_pushpop_safe_managed ()
voidthread_parallel_pushpop (void *args)
void test_parallel_pushpop ()
void test_pushpop_safe ()
voidthread_parallel_push_safe (void *args)
voidthread_parallel_pop_safe (void *args)
void test_parallel_pushpop_safe ()
void print_binary (uint64_t a)
void run ()

Define Documentation

#define DATA_IM   12
#define DATA_REAL   10
#define DATA_SIZE   sizeof(complex_t)
#define debug_int (   var)    printf("[%s:%s:%d] %s = %d\n", __FILE__, __FUNCTION__, __LINE__, #var, var);

Definition at line 218 of file test_stack.c.

#define debug_size_t (   var)    printf("[%s:%s:%d] %s = %zu\n", __FILE__, __FUNCTION__, __LINE__, #var, var);

Definition at line 219 of file test_stack.c.

#define debug_str (   var)    printf("[%s:%s:%d] %s = \"%s\"\n", __FILE__, __FUNCTION__, __LINE__, #var, var);

Definition at line 217 of file test_stack.c.

#define MAX_PUSH_POP   10

Definition at line 34 of file test_stack.c.

#define NB_THREADS   2

Definition at line 35 of file test_stack.c.

#define test_run (   test)
Value:
printf("[%s:%s:%i] Running test '%s'... ", __FILE__, __FUNCTION__, __LINE__, #test);\
  test_setup();\
  if(test())\
  {\
    printf("passed\n");\
  }\
  else\
  {\
    printf("failed\n");\
  }\
  test_teardown();

Definition at line 37 of file test_stack.c.


Typedef Documentation

Definition at line 66 of file test_stack.c.

Definition at line 56 of file test_stack.c.


Function Documentation

Definition at line 96 of file test_stack.c.

void init ( )

Definition at line 81 of file test_stack.c.

void print_binary ( uint64_t  a)

Definition at line 673 of file test_stack.c.

void run ( )

Definition at line 763 of file test_stack.c.

Definition at line 67 of file test_stack.c.

Definition at line 107 of file test_stack.c.

Definition at line 298 of file test_stack.c.

Definition at line 417 of file test_stack.c.

Definition at line 137 of file test_stack.c.

Definition at line 154 of file test_stack.c.

Definition at line 198 of file test_stack.c.

Definition at line 113 of file test_stack.c.

Definition at line 174 of file test_stack.c.

Definition at line 337 of file test_stack.c.

Definition at line 222 of file test_stack.c.

Definition at line 385 of file test_stack.c.

Definition at line 369 of file test_stack.c.

Definition at line 284 of file test_stack.c.