head	1.8;
access
	thoth
	monica;
symbols
	r0_9:1.4
	Eglin_alpha_1:1.4;
locks; strict;
comment	@// @;


1.8
date	94.10.06.00.43.40;	author monica;	state Exp;
branches;
next	1.7;

1.7
date	94.10.03.17.38.20;	author monica;	state Exp;
branches;
next	1.6;

1.6
date	94.09.22.16.44.41;	author monica;	state Exp;
branches;
next	1.5;

1.5
date	94.08.17.03.52.24;	author monica;	state Exp;
branches;
next	1.4;

1.4
date	92.12.14.16.21.46;	author jm;	state Exp;
branches;
next	1.3;

1.3
date	92.10.22.14.07.42;	author jm;	state Exp;
branches;
next	1.2;

1.2
date	92.09.16.17.29.17;	author jm;	state Exp;
branches;
next	1.1;

1.1
date	92.09.16.16.47.00;	author jm;	state Exp;
branches;
next	;


desc
@test program #004
@


1.8
log
@made dos filename compatible
@
text
@/*
   $RCS$
   $Log: test004.c,v $
// Revision 1.7  1994/10/03  17:38:20  monica
// *** empty log message ***
//
// Revision 1.6  1994/09/22  16:44:41  monica
// changed fill to fill_array
//
// Revision 1.5  1994/08/17  03:52:24  monica
// added int main
// added return 0
//
 * Revision 1.4  1992/12/14  16:21:46  jm
 *   Renamed class Set to IA_Set
 *
 * Revision 1.3  92/10/22  14:07:42  jm
 * checks fix on "<=" operator on valuesets.
 * 
 * Revision 1.2  92/09/16  17:29:17  jm
 * *** empty log message ***
 * 
*/

#include <stdlib.h>
#include "gen-test.h"
#include "vs-util.h"
#include "test.h"

typedef int IA_ValueType;

int main(int argc, char**argv)
{
    unsigned l1, l2;
    l1 = (argc<2) ? 40 : atoi(argv[1]);
    l2 = (argc<3) ? 40 : atoi(argv[2]);
    
    IA_ValueType *a1 = new IA_ValueType[l1];
    IA_ValueType *a2 = new IA_ValueType[l2];
    
    cout << "ready to fill the arrays\n"; 
    
    unsigned i;
    for (i=0; i<l1; i++)
	a1[i] = make_random_value((IA_ValueType) 0, 30 );
    cout << "array 1 fill_arrayed\n" ;
    for (i=0; i<l2; i++)
	a2[i] = make_random_value((IA_ValueType) 0, 30);
    cout << "array 2 fill_arrayed\n" ;
    
    IA_Set<IA_ValueType>	vs1(a1,l1);
    IA_Set<IA_ValueType> vs2(a2,l2);
    
    cout << "outputting vs 1\n"; set(vs1);
    cout << "outputting vs 2\n"; set(vs2);
    
    unsigned	c1, c2, only1, only2, overlap;

    c1 = vs1.card();
    c2 = vs2.card();

    IA_Set<IA_ValueType> temp;

    temp = vs1|vs2;
    cout << "vs1|vs2: "; // << temp;
    set(temp);
    test_union(vs1,vs2,temp);

    overlap = c1+c2 - temp.card();
    only1 = c1-overlap;
    only2 = c2-overlap;
    cout << c1 << " = " << only1 << " + " << overlap << '\n';
    cout << c2 << " = " << only2 << " + " << overlap << '\n';

    temp = vs1&vs2;
    cout << "vs1&vs2: ";
    set(temp);
//    test_inter(vs1,vs2,temp);

    if (temp.card()!=overlap) {
	cout << "cardinality inconsistency: " << temp.card() << " != "
	    << overlap << '\n';
    }
    
    temp = vs1^vs2;
    cout << "vs1^vs2: "; // << temp;
    set(temp);
    test_sdiff(vs1,vs2,temp);
    
    if (temp.card()!=only1+only2) {
	cout << "cardinality inconsistency: " << temp.card() << " != "
	    << (only1+only2) << '\n';
    }
    
    temp = vs1/vs2;
    cout << "vs1/vs2: "; // << temp;
    set(temp);
    test_minus(vs1,vs2,temp);
    
    if (temp.card()!=only1) {
	cout << "cardinality inconsistency: " << temp.card() << " != "
	    << only1 << '\n';
    }

    IA_Set<IA_ValueType> vs3(6,8);
    cout << "vs3: "; set(vs3); 
    if (vs3<temp)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (vs3>temp)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (vs3<=temp)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (vs3>=temp)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";

    if (temp<vs3)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (temp>vs3)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (temp<=vs3)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (temp>=vs3)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";
    
    vs3 = IA_Set<IA_ValueType>(3,6,8,29);
    
    cout << "vs3: "; set(vs3); 

    if (vs3<temp)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (vs3>temp)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (vs3<=temp)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (vs3>=temp)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";


    if (temp<vs3)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (temp>vs3)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (temp<=vs3)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (temp>=vs3)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";
    
    vs3 = IA_Set<IA_ValueType>(3,6,7,28);
    
    cout << "vs3: "; set(vs3); 

    if (vs3<temp)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (vs3>temp)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (vs3<=temp)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (vs3>=temp)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";


    if (temp<vs3)
	cout << "vs3 is a proper subset of temp\n";
    else
	cout << "vs3 is not a proper subset of temp\n";
    if (temp>vs3)
	cout << "vs3 is a proper superset of temp\n";
    else
	cout << "vs3 is not a proper superset of temp\n";
    if (temp<=vs3)
	cout << "vs3 is a subset of temp\n";
    else
	cout << "vs3 is not a subset of temp\n";
    if (temp>=vs3)
	cout << "vs3 is a superset of temp\n";
    else
	cout << "vs3 is not a superset of temp\n";
    

    IA_Set<int> v1, v2;

    v1 = 2;    cout << "v1: "; set(v1); 

    v2 = 1;    cout << "v2: "; set(v2); 

    if (v1<v2)
	cout << "v1 is a proper subset of v2\n";
    else
	cout << "v1 is not a proper subset of v2\n";
    if (v1>v2)
	cout << "v1 is a proper superset of v2\n";
    else
	cout << "v1 is not a proper superset of v2\n";
    if (v1<=v2)
	cout << "v1 is a subset of v2\n";
    else
	cout << "v1 is not a subset of v2\n";
    if (v1>=v2)
	cout << "v1 is a superset of v2\n";
    else
	cout << "v1 is not a superset of v2\n";

    v1 = IA_Set<IA_ValueType>(1,2); cout << "v1: "; set(v1); 
    v2 = 1;   cout << "v2: "; set(v2); 

    if (v1<v2)
	cout << "v1 is a proper subset of v2\n";
    else
	cout << "v1 is not a proper subset of v2\n";
    if (v1>v2)
	cout << "v1 is a proper superset of v2\n";
    else
	cout << "v1 is not a proper superset of v2\n";
    if (v1<=v2)
	cout << "v1 is a subset of v2\n";
    else
	cout << "v1 is not a subset of v2\n";
    if (v1>=v2)
	cout << "v1 is a superset of v2\n";
    else
	cout << "v1 is not a superset of v2\n";

    return 0;

}
@


1.7
log
@*** empty log message ***
@
text
@d4 3
d26 2
a27 2
#include "generic-tests.h"
#include "valueset-utils.h"
@


1.6
log
@changed fill to fill_array
@
text
@d4 3
d51 2
a52 2
    cout << "outputting vs 1\n"; op(cout, vs1);
    cout << "outputting vs 2\n"; op(cout, vs2);
d63 1
a63 1
    op(cout, temp);
d74 2
a75 2
    op(cout, temp);
    test_inter(vs1,vs2,temp);
d84 1
a84 1
    op(cout, temp);
d94 1
a94 1
    op(cout, temp);
d103 1
a103 1
    cout << "vs3: "; op(cout, vs3); 
d140 1
a140 1
    cout << "vs3: "; op(cout, vs3); 
d179 1
a179 1
    cout << "vs3: "; op(cout, vs3); 
d219 1
a219 1
    v1 = 2;    cout << "v1: "; op(cout, v1); 
d221 1
a221 1
    v2 = 1;    cout << "v2: "; op(cout, v2); 
d240 2
a241 2
    v1 = IA_Set<IA_ValueType>(1,2); cout << "v1: "; op(cout, v1); 
    v2 = 1;   cout << "v2: "; op(cout, v2); 
@


1.5
log
@added int main
added return 0
@
text
@d4 4
d40 1
a40 1
    cout << "array 1 filled\n" ;
d43 1
a43 1
    cout << "array 2 filled\n" ;
@


1.4
log
@  Renamed class ValueSet to IA_ValueSet
@
text
@d3 4
a6 1
   $Log:	test004.c,v $
a15 2
#include <stream.h>
#include "ValueSet.h"
d18 1
d20 1
a20 1
typedef int ValueType;
d28 2
a29 2
    ValueType *a1 = new ValueType[l1];
    ValueType *a2 = new ValueType[l2];
d35 1
a35 1
	a1[i] = make_random_value((ValueType) 0, 30 );
d38 1
a38 1
	a2[i] = make_random_value((ValueType) 0, 30);
d41 2
a42 2
    IA_ValueSet<ValueType>	vs1(a1,l1);
    IA_ValueSet<ValueType> vs2(a2,l2);
d52 1
a52 1
    IA_ValueSet<ValueType> temp;
d95 1
a95 1
    IA_ValueSet<ValueType> vs3(6,8);
d131 1
a131 1
    vs3 = IA_ValueSet<ValueType>(3,6,8,29);
d170 1
a170 1
    vs3 = IA_ValueSet<ValueType>(3,6,7,28);
d210 1
a210 1
    IA_ValueSet<int> v1, v2;
d233 1
a233 1
    v1 = IA_ValueSet<ValueType>(1,2); cout << "v1: "; op(cout, v1); 
a251 1
}
d253 1
d255 1
a255 4




@


1.3
log
@checks fix on "<=" operator on valuesets.
@
text
@d4 3
d39 2
a40 2
    ValueSet<ValueType>	vs1(a1,l1);
    ValueSet<ValueType> vs2(a2,l2);
d50 1
a50 1
    ValueSet<ValueType> temp;
d93 1
a93 1
    ValueSet<ValueType> vs3(6,8);
d129 1
a129 1
    vs3 = ValueSet<ValueType>(3,6,8,29);
d168 1
a168 1
    vs3 = ValueSet<ValueType>(3,6,7,28);
d208 1
a208 1
    ValueSet<int> v1, v2;
d231 1
a231 1
    v1 = ValueSet<ValueType>(1,2); cout << "v1: "; op(cout, v1); 
@


1.2
log
@*** empty log message ***
@
text
@d3 4
a6 1
   $Log$
d205 42
@


1.1
log
@Initial revision
@
text
@d1 4
a4 6
// Emacs: -*- C++ -*-
static char rcsid[] = "$Id$";

// 
// $Log$
//
@
