head     1.3;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


1.3
date     92.07.02.18.05.43;  author fischer;  state Exp;
branches ;
next     1.2;

1.2
date     92.06.30.05.10.10;  author fischer;  state Exp;
branches ;
next     1.1;

1.1
date     92.06.28.04.11.06;  author fischer;  state Exp;
branches ;
next     ;


desc
@A fairly thourough test of the , operator on points.
@


1.3
log
@renamed concat operator ``,'' to friend concat().
@
text
@// Emacs: -*- C++ -*-

static char rcsid[] = "$Id: test-concatenation.cc,v 1.2 92/06/30 05:10:10 fischer Exp Locker: fischer $";

//
// $Log:	test-concatenation.cc,v $
// Revision 1.2  92/06/30  05:10:10  fischer
// Minor additions: Point P(); P = (P, P) and P = (P, 1, 1).
// 
// Revision 1.1  92/06/28  04:11:06  fischer
// Initial revision
// 
// 
// 

#include <Point.h>

int main(int argc, char**argv)
{
    Point	p(10,20,30,40), q(0.0), r, P;
    Coord       a(11), b(2.0), c;
    void        prlp (char*, Point&);
    void        prlc (char*, Coord&);
    void        prp (Point&);
    void        prc (Coord&);
    
    IA::exit_on_throw = 0;

    prlp("p: ", p);    prlp("q: ", q);    prlp("r: ", r);
    prlc("a: ", a);    prlc("b: ", b);    prlc("c: ", c);

    P = concat(P, P);
    prlp("P = concat(P, P); ", P);
    
    P = concat(P, 1);
    prlp("P = concat(P, 1); ", P);
    
    P = concat(P, 1.2);
    prlp("P = concat(P, 1.2); ", P);
    
    P = concat(P, 2);
    prlp("P = concat(P, 2); ", P);
    
    P = concat(p, q);
    prlp("P = concat(p, q); ", P);
    P = concat(q, p);
    prlp("P = concat(q, p); ", P);

    P = concat(q, q);
    prlp("P = concat(q, q); ", P);

    P = concat(q, r);
    prlp("P = concat(q, r); ", P);
    P = concat(r, q);
    prlp("P = concat(r, q); ", P);

    P = concat(p, a);
    prlp("P = concat(p, a); ", P);
    P = concat(a, p);
    prlp("P = concat(a, p); ", P);

    P = concat(p, b);
    prlp("P = concat(p, b); ", P);
    P = concat(b, p);
    prlp("P = concat(b, p); ", P);

    P = concat(p, c);
    prlp("P = concat(p, c); ", P);
    P = concat(c, p);
    prlp("P = concat(c, p); ", P);
    
    P = concat(a, c);
    prlp("P = concat(a, c); ", P);
    P = concat(c, a);
    prlp("P = concat(c, a); ", P);
    
    P = concat(b, c);
    prlp("P = concat(b, c); ", P);
    P = concat(c, b);
    prlp("P = concat(c, b); ", P);
    
    P = concat(c, c);
    prlp("P = concat(c, c); ", P);
    
    // Should throw
    
    P = concat(p, p);
    prlp("P = concat(p, p); - expected error - ", P);

    
    for (Coord i = -1; i <= 1; i++) {
	P = (i); 
	cout << P.type() << ": \t" << P << "\n";
	for (Coord j = -1; j <= 1; j++) {
	    P = concat(i, j); 
	    cout << P.type() << ": \t" << P << "\n";
	    for (Coord k = -1.0; k <= 1.0; k++) {
		P = concat(i, concat(j, k)); 
		cout << P.type() << ": \t" << P << "\n";
		for (Coord l = -1; l <= 1; l++) {
		    P = concat(concat(i, j), concat(k, l)); 
		    cout << P.type() << ": \t" << P << "\n";
		}
	    }
	}
    }

}

void
prp (Point& p)
{
    cout << p << "(" << p.type() << ")";
}

void
prc (Point& c)
{
    if (c.type() == NONE)
	cout << "()";
    else
	cout << c << "(" << c.type() << ")";
}


void
prlp (char *label, Point& p)
{
    cout << "Point " << label << p << "(" << p.type() << ")\n";
}

void
prlc (char* label, Coord& c)
{
    if (c.type() == NONE)
	cout << "Coord " << label << "(Empty)\n";
    else
	cout << "Coord " << label << c << "(" << c.type() << ")\n";
}


@


1.2
log
@Minor additions: Point P(); P = (P, P) and P = (P, 1, 1).
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: test-concatenation.cc,v 1.1 92/06/28 04:11:06 fischer Exp Locker: fischer $";
d7 3
d32 2
a33 2
    P = (P, P);
    prlp("P = (P, P); ", P);
d35 2
a36 2
    P = (P, 1, 1);
    prlp("P = (P, 1, 1); ", P);
d38 10
a47 4
    P = (p, q);
    prlp("P = (p, q); ", P);
    P = (q, p);
    prlp("P = (q, p); ", P);
d49 2
a50 2
    P = (q, q);
    prlp("P = (q, q); ", P);
d52 4
a55 4
    P = (q, r);
    prlp("P = (q, r); ", P);
    P = (r, q);
    prlp("P = (r, q); ", P);
d57 4
a60 4
    P = (p, a);
    prlp("P = (p, a); ", P);
    P = (a, p);
    prlp("P = (a, p); ", P);
d62 4
a65 4
    P = (p, b);
    prlp("P = (p, b); ", P);
    P = (b, p);
    prlp("P = (b, p); ", P);
d67 4
a70 4
    P = (p, c);
    prlp("P = (p, c); ", P);
    P = (c, p);
    prlp("P = (c, p); ", P);
d72 4
a75 4
    P = (a, c);
    prlp("P = (a, c); ", P);
    P = (c, a);
    prlp("P = (c, a); ", P);
d77 4
a80 4
    P = (b, c);
    prlp("P = (b, c); ", P);
    P = (c, b);
    prlp("P = (c, b); ", P);
d82 2
a83 2
    P = (c, c);
    prlp("P = (c, c); ", P);
d87 2
a88 2
    P = (p, p);
    prlp("P = (p, p); - expected error - ", P);
d95 1
a95 1
	    P = (i, j); 
d98 1
a98 1
		P = (i, j, k); 
d101 1
a101 1
		    P = (i, j, k, l); 
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
static char rcsid[] = "$Id$";
d6 3
a8 1
// $Log$
d11 1
d29 6
@
