forked from shashank3395/TestCaseGenerator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdahi_jalebi.cpp
More file actions
318 lines (269 loc) · 7.97 KB
/
dahi_jalebi.cpp
File metadata and controls
318 lines (269 loc) · 7.97 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout <<">>"<<#x<<": "<<(x)<< endl;
#define DEBUG2(x,y) cout<<#x<<" :: "<<x<<" "<<#y<<" :: "<<y<<endl;
#define boost ios::sync_with_stdio(0); cin.tie(0)
#define mem(x,val) memset((x),(val),sizeof(x))
#define fi first
#define sc second
#define pb push_back
#define mp make_pair
#define ll long long int
#define LL long long int
#define pii pair<ll,ll>
const ll INF = 2e18;
ll M = 1000000007 ;
void function_1(ll n_,ll max_,ll min_,ll flag);
void function_5(ll n_,ll max_,ll min_,ll flag);
void function_8(ll n_);
void function_9(ll n_,string particular);
void function_10(ll n_,int flagalph);
void function_11(long long int n_);
void function_12(long long int n_);
void function_13(long long int n_,long long int m_,string str);
int test_cases,flag_t=1;
FILE* fptr;
int main()
{
remove("generated_test_cases.txt");
cout<<"1) Normal Array\n2) Pair-Wise Distinct Array\n3) Permutation Array\n4) Ordered Array(Sorted/Unsorted)\n5) Array of Pairs\n6) 2D Matrix\n7) 2D Matrix Permutation\n";
cout<<"8) Number String\n9) Particular String(with Desired Characters)\n10) String of Aphabets\n11) string of Special Characters\n12) Alphanumeric Strings\n13) 2D String\n";
cout<<"14) Star Shaped Tree\n15) Normal Tree rooted at node\n16) Binary Tree\n17) Normal tree with edge weight\n 18) Normal Tree with Node Weight\n19) Graph through Adjacency Matrix\n";
cout<<"20) Sparse Graph\n21) Undirected acyclic graph\n22) Random Graph\n23) Graph with given max degree\n24) Connected Graph\n";
int option;
ll n_,m_,min_,max_;
string particular;
bool flag;
int flagalph;
cout<<"Enter Your option(1-24)\n";
cin>>option;
cout<<"Enter number of Test cases\n";
cin>>test_cases;
switch(option)
{
case 1:cout<<"Enter maximum size of array : ";
cin>>n_;
cout<<"upper bound of array elements : ";
cin>>max_;
cout<<"Lower bound of array Elements : ";
cin>>min_;
cout<<"Do you need float values";
cin>>flag;
//function_1(n_,max_,min_,flag);
break;
case 5:cout<<"Enter maximum size of array of pairs: ";
cin>>n_;
cout<<"upper bound of array elements : ";
cin>>max_;
cout<<"Lower bound of array Elements : ";
cin>>min_;
cout<<"Do you need float values";
cin>>flag;
function_5(n_,max_,min_,flag);
break;
case 8:cout<<"Enter maximum size of string : ";
cin>>n_;
function_8(n_);
break;
case 9:cout<<"Enter maximum size of string : ";
cin>>n_;
cout<<"Enter the diff character that will be used in the string:";
cin>>particular;
function_9(n_,particular);
break;
case 10:cout<<"Enter maximum size of string : ";
cin>>n_;
cout<<"Enter 1. for lowercase string only\n2. for uppercase string only\n 3.for mixed characters\n";
cin>>flagalph;
function_10(n_,flagalph);
break;
case 11:cout<<"Enter maximum size of string : ";
cin>>n_;
function_11(n_);
break;
case 12:cout<<"Enter maximum size of string : ";
cin>>n_;
function_12(n_);
break;
case 13:cout<<"Enter maximum width of 2D-string : ";
cin>>n_;
cout<<"Enter maximum height of 2D-string : ";
cin>>m_;
cout<<"Enter the diff character that will be used in the string:";
cin>>particular;
function_13(n_,m_,particular);
break;
}
return 0;
}
void generate_numbers_5(ll n, LL x, LL y,int flag) {
LL mod = (y - x + 1);
LL displace = x;
for(int i=1; i<=n; ++i) {
LL number1 = ((LL)rand() * rand()) % mod + displace;
LL number2 = ((LL)rand() * rand()) % mod + displace;
assert(number1 >= x && number1 <= y);
assert(number2 >= x && number2 <= y);
double r1 = static_cast <double> (rand()) / static_cast <double> (RAND_MAX);
double r2 = static_cast <double> (rand()) / static_cast <double> (RAND_MAX);
if(flag)
{
printf("%lf %lf", number1*r1, number2*r2);
}
else
{
printf("%lld %lld", number1, number2);
}
if (i < n) {
printf("\n");
}
}
printf("\n");
}
void function_5(ll n_,ll max_,ll min_,ll flag)
{
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
for(int t=1; t<=test_cases; ++t) {
ll n = rand() % n_ + 1;
printf("%lld\n", n);
LL range_low = min_;
LL range_high = max_;
generate_numbers_5(n, range_low, range_high,flag);
}
}
void function_8(long long int n_) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user = "0123456789";
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
for(long long int i=1; i<=n; ++i) {
long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
}
void function_9(long long int n_,string str) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user = str;
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
for(long long int i=1; i<=n; ++i) {
long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
}
void function_10(long long int n_,int flagalph) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user;
if(flagalph==1)
user = "qwertyuioplkjhgfdsazxcvbnm";
else if(flagalph==2)
user = "QWERTYUIOPLKJHGFDSAZXCVBNM";
else
user = "QWERTYUIOPLKqwertyuioplkjhgfdsazxcvbnmJHGFDSAZXCVBNM";
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
for(long long int i=1; i<=n; ++i) {
long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
}
void function_11(long long int n_) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user = "!~`@#$%^&*()_-+=][}{|;:><?/";
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
for(long long int i=1; i<=n; ++i) {
long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
}
void function_12(long long int n_) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user = "0123456789QWERTYUIOPLKqwertyuioplkjhgfdsazxcvbnmJHGFDSAZXCVBNM";
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
for(long long int i=1; i<=n; ++i) {
long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
}
void function_13(long long int n_,long long int m_,string str) {
fptr = freopen("generated_test_cases.txt", "a", stdout);
if(flag_t==1)
{
cout<<test_cases<<endl;
flag_t=0;
}
string user = str;
long long int mod = user.length();
for(int k=0;k<test_cases;k++)
{ ll n = rand() % n_ + 1;
ll m = rand() % m_ + 1;
for(long long int i=1; i<=m; ++i)
{
for(long long int j=1;j<=n; ++j)
{ long long int number = rand() % mod;
assert(number >= 0 && number < mod);
char ch = user[number];
printf("%c", ch);
}
cout<<"\n";
}
cout<<"\n";
}
}