Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

testfed.cpp File Reference

#include <time.h>
#include <iostream>
#include "dbm/fed.h"
#include "dbm/gen.h"
#include "dbm/print.h"
#include "dbm/dbmfederation.h"
#include "debug/utils.h"
#include "debug/macros.h"

Defines

#define SHOW_TEST()   (cout << '.').flush()
#define SKIP_TEST()   (cout << '?').flush()
#define NO_TEST()   (cout << '*').flush()
#define PROGRESS()   debug_spin(stderr)
#define NB_LOOPS   250
#define CHEAP   dim <= 100 && size <= 100
#define NEW_FED(NAME, DIM)   DBMFederation_t NAME; dbmf_initFederation(&NAME, DIM)
#define DEL_FED(NAME)   dbmf_deallocateFederation(&factory, &NAME)

Functions

static bool test_isPointIn (const int32_t *pt, const fed_t &fed, cindex_t dim)
 Test that a discrete point is in a DBM list.
static bool test_isRealPointIn (const double *pt, const fed_t &fed, cindex_t dim)
 Test that a real point is in a DBM list.
static fed_t test_gen (cindex_t dim, size_t n)
 Generate a federation of n DBMs.
static const dbm_ttest_getDBM (const fed_t &fed)
 Pick one DBM from a federation of DBMs.
static bool test_generateRealPoint (double *pt, const fed_t &fed)
 Generate a real point in a federation.
static bool test_generatePoint (int32_t *pt, const fed_t &fed)
 Add some superset/subset DBMs to a federation.
static void test_addDBMs (fed_t &fed, size_t nb)
static fed_t test_genArg (size_t n, const fed_t &fed)
 Generate arguments for an operation with a federation.
static size_t test_genConstraints (const fed_t &fed, size_t n, constraint_t *constraints)
 Generate constraints for a federation.
static void test_mix (fed_t &fed)
 Mix a DBM list: misuse of quicksort.
static DBMFederation_t test_new2old (const fed_t &fed)
static fed_t test_old2new (const DBMFederation_t &fed)
static void test_setZero (cindex_t dim)
static void test_setInit (cindex_t dim)
static void test_copy (cindex_t dim, size_t size)
static void test_union (cindex_t dim, size_t size)
static void test_convexUnion (cindex_t dim, size_t size)
static void test_intersection (cindex_t dim, size_t size)
static void test_constrain (cindex_t dim, size_t size)
static void test_up (cindex_t dim, size_t size)
static void test_down (cindex_t dim, size_t size)
void test_freeClock (cindex_t dim, size_t size)
static void test_updateValue (cindex_t dim, size_t size)
static void test_updateClock (cindex_t dim, size_t size)
static void test_updateIncrement (cindex_t dim, size_t size)
static void test_update (cindex_t dim, size_t size)
static void test_satisfies (cindex_t dim, size_t size)
static void test_constrainEmpty (cindex_t dim, size_t size)
static void test_isUnbounded (cindex_t dim, size_t size)
static void test_relation (cindex_t dim, size_t size)
static void test_freeAllUp (cindex_t dim, size_t size)
static void test_freeAllDown (cindex_t dim, size_t size)
static void test_freeDown (cindex_t dim, size_t size)
static void test_freeUp (cindex_t dim, size_t size)
static void test_relaxUp (cindex_t dim, size_t size)
static void test_equal (cindex_t dim, size_t size)
static void test_subtract (cindex_t dim, size_t size)
static void test_predt (cindex_t dim, size_t size)
static void test_reduce (cindex_t dim, size_t size)
void test (int dim, int size)
int main (int argc, char *argv[])

Variables

DBMAllocator_t factory

Define Documentation

#define CHEAP   dim <= 100 && size <= 100
 

#define DEL_FED NAME   )     dbmf_deallocateFederation(&factory, &NAME)
 

#define NB_LOOPS   250
 

#define NEW_FED NAME,
DIM   )     DBMFederation_t NAME; dbmf_initFederation(&NAME, DIM)
 

 
#define NO_TEST  )     (cout << '*').flush()
 

 
#define PROGRESS  )     debug_spin(stderr)
 

 
#define SHOW_TEST  )     (cout << '.').flush()
 

 
#define SKIP_TEST  )     (cout << '?').flush()
 


Function Documentation

int main int  argc,
char *  argv[]
 

void test int  dim,
int  size
 

static void test_addDBMs fed_t fed,
size_t  nb
[static]
 

static void test_constrain cindex_t  dim,
size_t  size
[static]
 

static void test_constrainEmpty cindex_t  dim,
size_t  size
[static]
 

static void test_convexUnion cindex_t  dim,
size_t  size
[static]
 

static void test_copy cindex_t  dim,
size_t  size
[static]
 

static void test_down cindex_t  dim,
size_t  size
[static]
 

static void test_equal cindex_t  dim,
size_t  size
[static]
 

static void test_freeAllDown cindex_t  dim,
size_t  size
[static]
 

static void test_freeAllUp cindex_t  dim,
size_t  size
[static]
 

void test_freeClock cindex_t  dim,
size_t  size
 

static void test_freeDown cindex_t  dim,
size_t  size
[static]
 

static void test_freeUp cindex_t  dim,
size_t  size
[static]
 

static fed_t test_gen cindex_t  dim,
size_t  n
[static]
 

Generate a federation of n DBMs.

Parameters:
dim,: dimension of DBMs to generate
n,: number of DBMs to generate.
Returns:
n allocated and generated DBMs.

static fed_t test_genArg size_t  n,
const fed_t fed
[static]
 

Generate arguments for an operation with a federation.

Parameters:
n,: max size of the generated federation.
fed,: base federation.

static size_t test_genConstraints const fed_t fed,
size_t  n,
constraint_t constraints
[static]
 

Generate constraints for a federation.

Parameters:
fed,: federation.
n,: number of constraints to generate
constraints,: where to generate
Postcondition:
by constraining fed with constraints the result is not empty (if fed is not empty)
Returns:
number of generated constraints (may be < n)

static bool test_generatePoint int32_t *  pt,
const fed_t fed
[static]
 

Add some superset/subset DBMs to a federation.

Precondition:
fed.getDimension() > 1
Parameters:
fed,: federation to change.
nb,: number of DBMs to add.

static bool test_generateRealPoint double *  pt,
const fed_t fed
[static]
 

Generate a real point in a federation.

Parameters:
fed,: federation.
pt,: where to write the point = double[fed.getDimension()]
Precondition:
fed.size() > 0, fed.getDimension() > 1, otherwise no point to return

static const dbm_t& test_getDBM const fed_t fed  )  [static]
 

Pick one DBM from a federation of DBMs.

Parameters:
fed,: the federation.
Precondition:
fed.size() > 0, fed.getDimension() > 1, otherwise no DBM to return

static void test_intersection cindex_t  dim,
size_t  size
[static]
 

static bool test_isPointIn const int32_t *  pt,
const fed_t fed,
cindex_t  dim
[static]
 

Test that a discrete point is in a DBM list.

Parameters:
pt,: point
fed,: federation of DBMs.
dim,: dimension of the DBMs and the point
Returns:
true if pt included in dbmList, false otherwise

static bool test_isRealPointIn const double *  pt,
const fed_t fed,
cindex_t  dim
[static]
 

Test that a real point is in a DBM list.

Parameters:
pt,: point
fed,: federation of DBMs.
dim,: dimension of the DBMs and the point
Returns:
true if pt included in dbmList, false otherwise

static void test_isUnbounded cindex_t  dim,
size_t  size
[static]
 

static void test_mix fed_t fed  )  [static]
 

Mix a DBM list: misuse of quicksort.

We can swap indices randomly too, but this is simpler (and quite cool).

Parameters:
dbmList,: list of DBMs
Precondition:
size <= 2^16

static DBMFederation_t test_new2old const fed_t fed  )  [static]
 

static fed_t test_old2new const DBMFederation_t fed  )  [static]
 

static void test_predt cindex_t  dim,
size_t  size
[static]
 

static void test_reduce cindex_t  dim,
size_t  size
[static]
 

static void test_relation cindex_t  dim,
size_t  size
[static]
 

static void test_relaxUp cindex_t  dim,
size_t  size
[static]
 

static void test_satisfies cindex_t  dim,
size_t  size
[static]
 

static void test_setInit cindex_t  dim  )  [static]
 

static void test_setZero cindex_t  dim  )  [static]
 

static void test_subtract cindex_t  dim,
size_t  size
[static]
 

static void test_union cindex_t  dim,
size_t  size
[static]
 

static void test_up cindex_t  dim,
size_t  size
[static]
 

static void test_update cindex_t  dim,
size_t  size
[static]
 

static void test_updateClock cindex_t  dim,
size_t  size
[static]
 

static void test_updateIncrement cindex_t  dim,
size_t  size
[static]
 

static void test_updateValue cindex_t  dim,
size_t  size
[static]
 


Variable Documentation

DBMAllocator_t factory
 


Generated on Fri Jun 30 00:02:46 2006 for Module dbm by  doxygen 1.4.2