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


1.3
date     92.06.16.14.25.37;  author thoth;  state Exp;
branches ;
next     1.2;

1.2
date     92.06.10.11.40.14;  author thoth;  state Exp;
branches ;
next     1.1;

1.1
date     92.05.21.15.11.49;  author thoth;  state Exp;
branches ;
next     ;


desc
@test program for addition.  can't test very
well until compiler is fixed.
@


1.3
log
@extended tests to cover major arithmetic operators.
@
text
@static char rcsid[] = "$Id: test003.cc,v 1.2 92/06/10 11:40:14 thoth Exp Locker: thoth $";

//
// $Log:	test003.cc,v $
// Revision 1.2  92/06/10  11:40:14  thoth
// updated to reflect new conventions
// 
// Revision 1.1  92/05/21  15:11:49  thoth
// Initial revision
// 
//


#include	<iostream.h>
#include	"Coord.h"
#include	"gork.h"

void testops(Coord c1,Coord c2,Coord c3,Coord c4, char*s, Coord (*f)(Coord,Coord))
{
#define testbank(n) \
    cout << "c" #n << s << "c1: " << f(c##n,c1) << '\t'; \
    cout << "c" #n << s << "c2: " << f(c##n,c2) << '\t'; \
    cout << "c" #n << s << "c3: " << f(c##n,c3) << '\t'; \
    cout << "c" #n << s << "c4: " << f(c##n,c4) << '\n'

    testbank(1);
    testbank(2);
    testbank(3);
    testbank(4);
}

int main()
{
    Coord	c1(7), c2(-4), c3(3.14), c4(89.2), a, b;

    outlabel(cout, "c1: ", c1);
    outlabel(cout, "c2: ", c2);
    outlabel(cout, "c3: ", c3);
    outlabel(cout, "c4: ", c4);

    testops(c1,c2,c3,c4,"+", operator+);
    testops(c1,c2,c3,c4,"-", operator-);
    testops(c1,c2,c3,c4,"*", operator*);
    testops(c1,c2,c3,c4,"/", operator/);

    cout << "c1%c2: " << c1%c2 << '\n';
    cout << "c1%c3(erroneous): " << c1%c3 << '\n';

    return 0;
}
@


1.2
log
@updated to reflect new conventions
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: test003.cc,v 1.1 92/05/21 15:11:49 thoth Exp Locker: thoth $";
d5 3
d18 14
d34 1
a34 1
    Coord	ci1(2), ci2(-4), cf1(3.14), cf2(89.2), a, b;
d36 4
a39 4
    outlabel(cout, "ci1: ", ci1);
    outlabel(cout, "ci2: ", ci2);
    outlabel(cout, "cf1: ", cf1);
    outlabel(cout, "cf2: ", cf2);
d41 4
a44 5
    // the commented out outlabels cause the compiler to hang.
    // outlabel(cout, "ci1+ci2: ", ci1+ci2);
    // outlabel(cout, "ci1+cf1: ", ci1+cf1);
    // outlabel(cout, "ci2+ci1: ", ci2+ci1);
    // outlabel(cout, "cf2+cf1: ", cf2+cf1);
d46 2
a47 3
    // this hangs too
    // a = ci1.plus(ci2);
    // outlabel(cout, "ci1+ci2: ", a);
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
static char rcsid[] = "$Id$";
d4 4
a7 1
// $Log$
d12 1
a12 1
#include	<Coord.h>
@
