Esempio n. 1
0
/*
	create a vector of 4 elements,
	insert two true values and one false value in it,
	verify that the vector contains two true values
*/
Test(simpl_infoTest,countTrueTest3) {
	pbit_vect v1=BV_create(4);
	BV_set(v1,0,1);
	BV_set(v1,1,1);
	BV_set(v1,2,0);
	cr_expect(countTrue(v1)==2);
}
Esempio n. 2
0
/*
 * is_not_window deve essere true, se il confronto e' di uguaglianza (cioe' factors e' stata costruita con
 * factors_list_create(), e deve essere false se factors e' stata costruita con
 * windows_list_create()
 */
void add_factoriz(pEST est,plist factorization,plist factors, bool is_not_window)
{

    my_assert((est!=NULL)&&(factorization!=NULL)&&(factors!=NULL));

    pfactor pf;
    plistit plist_it_factor;

    int factor_pos;
    pbit_vect bv=BV_create(list_size(factors));

    if(est->bin_factorizations==NULL) {
        est->bin_factorizations=list_create();
    }

    plist_it_factor=list_first(factorization);

    while(listit_has_next(plist_it_factor)) {

        pf=listit_next(plist_it_factor);
        factor_pos=get_factor_position(pf,factors,is_not_window);

        //fprintf(stdout, "\t\tFactor position %d\n", factor_pos);

        BV_set(bv,factor_pos,true);
    }
    list_add_to_tail(est->bin_factorizations,bv);
    listit_destroy(plist_it_factor);
}
Esempio n. 3
0
/*
	create a vector of 10 elements,
	insert two true values in arbitrary positions,
	verify that the vector contains two true values
*/
Test(simpl_infoTest,countTrueTest6) {
	pbit_vect v1=BV_create(10);
	BV_set(v1,7,1);
	BV_set(v1,4,1);
	cr_expect(countTrue(v1)==2);
}