#############################################################################

[main]

[main - data:]

# method (for information only: the program scans the file name)
method: DISTR_CEMP

[main - header:]

/* prototypes */

\#define COMPARE_SAMPLE_SIZE  (500)
\#define VIOLATE_SAMPLE_SIZE   (20)

#############################################################################

[new]

#############################################################################

[set]

[set - invalid NULL ptr:
   distr = NULL; ]

unur_distr_cemp_set_data( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_read_data( distr, "junk" );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist_prob( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist_domain( distr, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist_bins( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL


[set - invalid distribution type:
	distr = unur_distr_discr_new(); ]

unur_distr_cemp_set_data( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID

unur_distr_cemp_read_data( distr, "junk" );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID

unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID

unur_distr_cemp_set_hist_prob( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID

unur_distr_cemp_set_hist_domain( distr, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID

unur_distr_cemp_set_hist_bins( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_INVALID


[set - invalid NULL ptr: 
   distr = unur_distr_cemp_new(); ]

unur_distr_cemp_set_data( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist_prob( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL

unur_distr_cemp_set_hist_bins( distr, NULL, 0 );
        --> expected_setfailed --> UNUR_ERR_NULL


[set - invalid parameters: 
   double data[] = {1.,2.,3.};
   distr = unur_distr_cemp_new(); ]

unur_distr_cemp_set_data( distr, data, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_read_data( distr, "there-should-be-no-such-file" );
        --> expected_setfailed --> UNUR_ERR_GENERIC

unur_distr_cemp_set_hist( distr, data, 0, 0., 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_prob( distr, data, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist( distr, data, 3, 5., 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_domain( distr, 5., 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_domain( distr, -UNUR_INFINITY, 2. );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_domain( distr, 0., UNUR_INFINITY );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_bins( distr, data, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_bins( distr, data, 4 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET


[set - invalid parameters: 
   double prob[] = {1.,2.,3.};
   double bins[] = {1.,2.,3.,4.};
   distr = unur_distr_cemp_new(); 
   unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ]

unur_distr_cemp_set_hist_bins( distr, bins, 0 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_bins( distr, bins, 3 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_bins( distr, bins, 5 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET


[set - invalid parameters: 
   double prob[] = {1.,2.,3.};
   double bins[] = {1.,2.,-3.,4.};
   double binsinf[] = {1.,2.,3.,UNUR_INFINITY};
   distr = unur_distr_cemp_new(); 
   unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ]

unur_distr_cemp_set_hist_bins( distr, bins, 4 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET

unur_distr_cemp_set_hist_bins( distr, binsinf, 4 );
        --> expected_setfailed --> UNUR_ERR_DISTR_SET


#############################################################################

[get]

[get - invalid NULL ptr: 
   const double *sample;
   distr = NULL; ]

unur_distr_cemp_get_data( distr, &sample )
        --> expected_zero --> UNUR_ERR_NULL


[get - invalid distribution type:
   const double *sample;
   distr = unur_distr_discr_new(); ]

unur_distr_cemp_get_data( distr, &sample )
        --> expected_zero --> UNUR_ERR_DISTR_INVALID


#############################################################################

[chg]

##############################################################################

[init]

#############################################################################

[reinit]

#############################################################################

[sample]

[sample - compare stringparser:
   double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.};
   distr = NULL;
   par = NULL;
   gen = NULL; ]

distr = unur_distr_cemp_new();
unur_distr_cemp_set_data(distr,data,9);
par = unur_auto_new(distr);
gen = unur_init(par);
	-->compare_sequence_gen_start

unur_free(gen); gen = NULL;
gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.)" );
	-->compare_sequence_gen

unur_free(gen); gen = NULL;
gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \
  method = auto" );
	-->compare_sequence_gen

#............................................................................

[sample - compare stringparser:
   double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1};
   distr = NULL;
   par = NULL;
   gen = NULL; ]

distr = unur_distr_cemp_new();
unur_distr_cemp_set_hist_prob(distr,hist,9);
unur_distr_cemp_set_hist_domain(distr,1.,10.);
par = unur_auto_new(distr);
gen = unur_init(par);
	-->compare_sequence_gen_start

unur_free(gen); gen=NULL;
gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \
                    hist_domain=(1.,10.)");
        -->compare_sequence_gen

unur_free(gen); gen=NULL;
gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \
                    hist_domain=(1.,10.) & method = hist");
        -->compare_sequence_gen

#############################################################################

# [validate]

#############################################################################
#############################################################################

[verbatim]

#############################################################################
