Fundamentals
bool Or(bool a, bool b){
if(!a){
if(!b){
return false;
}
}
return true;
}
bool Xor(bool a, bool b){
return a != b;
}
bool And(bool a, bool b){
if(a){
if(b){
return true;
}
}
return false;
}
// TODO: Replace examples and use TDD development by writing your own tests
Describe(AND_OR_XOR)
{
It(AND)
{
Assert::That(And(true, false), Equals(false));
Assert::That(And(false, true), Equals(false));
Assert::That(And(true, true), Equals(true));
Assert::That(And(false, false), Equals(false));
}
It(OR)
{
Assert::That(Or(true, false), Equals(true));
Assert::That(Or(false, true), Equals(true));
Assert::That(Or(true, true), Equals(true));
Assert::That(Or(false, false), Equals(false));
}
It(XOR)
{
Assert::That(Xor(true, false), Equals(true));
Assert::That(Xor(false, true), Equals(true));
Assert::That(Xor(true, true), Equals(false));
Assert::That(Xor(false, false), Equals(false));
}
};
If it does not work, just say :).
template<typename T>
T add(T a, T b){
return a-(-b);
}
// TODO: Replace examples and use TDD development by writing your own tests
Describe(somathing)
{
It(basic)
{
Assert::That(add(1024, 1024), Equals(2048));
Assert::That(add(add(1.0, 1.5), add(32.0, 64.5)), Equals(99));
}
It(negativ_plus_positiv){
Assert::That(add(1024, -1024), Equals(0));
Assert::That(add(-512, 256));
}
};