Code:
#ifndef _FractionG_
#include "..\_SRC\FractionG.h"
#endif
#include "..\_SRC\FractionG.cpp"
#include "..\_SRC\FractionG_2.cpp"
#include "T:\_Tests\Tests\Tests.h"
void main () {
Tests::Begin("_Maths.FractionG", "2.0.0" );
Tests::Design("Control of operators (First part)", 3);
/*Tests::Case("Operator == : comparison of two FractionG" ); {
FractionG f1(3,3);
Fraction f2(5), f3(-3), f4(6);
int f5(2,1), f6(12,6), f7(3,1), f8(-3,1);
int f9(10,5), f10(-10,-5);
Tests::Unit(0, f1==f2);
Tests::Unit(1, f3==f4);
Tests::Unit(1, f5==f6);
Tests::Unit(0, f7==f8);
Tests::Unit(0, f9==f10);
Tests::Unit(1, f2==f9);
}*/
Tests::Case("Operator == : comparison with an integer" ); {
int f1(2), f2(-2), f3(0), f4(0);
Tests::Unit(1, f1==2);
Tests::Unit(1, f2==-2);
Tests::Unit(1, f3==0);
Tests::Unit(0, f4==-1);
}
/*Tests::Case("Operator != : comparison of two FractionGs" ); {
int f1(2), f2(7), f3(-2), f4(2);
int f5(2), f6(-4), f7(1), f8(1);
Tests::Unit(1, f1!=f2);
Tests::Unit(1, f3!=f4);
Tests::Unit(0, f4!=f5);
Tests::Unit(1, f5!=f6);
Tests::Unit(0, f7!=f8);
}*/
Tests::Case("Operator != : comparison with an integer" ); {
int f1(2), f2(4), f3(-1), f4(-1);
Tests::Unit(0, f1!=2);
Tests::Unit(1, f2!=-2);
Tests::Unit(1, f3!=0);
Tests::Unit(0, f4!=-1);
}
Tests::Design("Control of operators (Second part)", 3);
/*Tests::Case("Operator = : case of two FractionGs" ); {
FractionG& <FractionG> f1(2,3), f2(5,4);
FractionG& <FractionG> f(0);
f=f1; Tests::Unit(1, f==f1);
Tests::Unit(0, f==f2);
f1=f2; Tests::Unit(0, f1==f);
Tests::Unit(1, f1==f2);
}
Tests::Case("Operator = : case of an integer" ); {
FractionG& <FractionG> f(-1);
f=0; Tests::Unit(0, f==1);
Tests::Unit(1, f==0);
Tests::Unit(1, f==-0);
f=7; Tests::Unit(0, f==0);
Tests::Unit(1, f==7);
}
*/
Tests::End();
}
Bookmarks