#include<time.h> // TODO: Replace examples and use TDD by writing your own tests using namespace std; Describe(Small_examples) { It(Example_tests) { Assert::That(two_squares(1,2), Equals(make_pair(1,3))); Assert::That(two_squares(2,6), Equals(make_pair(4,8))); Assert::That(two_squares(2,5), Equals(make_pair(3,7))); } }; // random tests: Describe(Random_tests){ It(Example_random_tests){ srand(time(NULL)); int a=rand()% 1000, b=rand()% 1000; for(int i=0; i<50; i++){ Assert::That(two_squares(a, b), Equals(make_pair(b-a, a+b))); a=rand()% 1000; b=rand()% 1000; } } };
- #include<time.h>
- // TODO: Replace examples and use TDD by writing your own tests
- using namespace std;
- Describe(Small_examples)
- {
- It(Example_tests)
{- {
- Assert::That(two_squares(1,2), Equals(make_pair(1,3)));
- Assert::That(two_squares(2,6), Equals(make_pair(4,8)));
- Assert::That(two_squares(2,5), Equals(make_pair(3,7)));
- }
- };
- // random tests:
- Describe(Random_tests){
- It(Example_random_tests){
- srand(time(NULL));
- int a=rand()% 1000, b=rand()% 1000;
- for(int i=0; i<50; i++){
- Assert::That(two_squares(a, b), Equals(make_pair(b-a, a+b)));
- a=rand()% 1000;
- b=rand()% 1000;
- }
- }
- };