-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStress_testing.cpp
55 lines (51 loc) · 1.12 KB
/
Stress_testing.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*Stress Testing
It is done to check if our method is working fine for each and every test case, we generate some random values using rand
function or even if we want to get arrray we can get by filling an array through loop and rand function.
what we do in stress testing
We use two functions one we know is working well and other function we want to check, we just give our values to these
functions and check if both fubctions are giving the same output.
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void fun(int a, int b)
int c, d, s1 = 0, s2 = 0, s3 = 0, s4 = 0;
c = a;
d = b;
while(a != 0 || b != 0) {
s1 += a%10;
s2 += b%10;
a /= 10;
b /= 10;
}
a = c;
b = d;
while(a != 0) {
s3 += a%10;
a /= 10;
}
while(b != 0) {
s4 += b%10;
b /= 10;
}
a = c;
b = d;
if(s1 != s3 || s2 != s4)
cout<<"Breaked for "<<a<<" "<<b<<"\n";
}
int main()
{
int t;
t = 1;
while(t--)
{
ll int n = 10000000;
int a, b;
while(n--) {
a = rand()%100000 + 1;
b = rand()%100000 + 1;
fun(a, b);
}
}
return 0;
}