testgenie-py 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,397 +0,0 @@
1
- def random_fuzz_code(x: int, y: int) -> int:
2
- """
3
- >>> random_fuzz_code(-2130231320, -1191318765)
4
- -3321550085
5
- >>> random_fuzz_code(-339569712, -1002922858)
6
- 663353146
7
- """
8
-
9
- result = x
10
- if x < y:
11
- result += y
12
- else:
13
- result -= y
14
- return result
15
-
16
-
17
- def bin_and(a: bool, b: bool) -> bool:
18
- """
19
- >>> bin_and(False, False)
20
- False
21
- >>> bin_and(True, True)
22
- True
23
- >>> bin_and(True, False)
24
- False
25
- """
26
- if a == True:
27
- if b == True:
28
- return True
29
- else:
30
- return False
31
- else:
32
- return False
33
-
34
-
35
- def pos_or_neg(i: int):
36
- """
37
- >>> pos_or_neg(1846918201)
38
- 1
39
- >>> pos_or_neg(-1651100677)
40
- -1
41
- """
42
-
43
- if i > 0:
44
- sgn = 1
45
- else:
46
- sgn = -1
47
- if sgn > 0:
48
- return 1
49
- elif sgn < 0:
50
- return -1
51
- # else sgn == 0
52
- # no return here
53
-
54
-
55
- def int_even(x: int):
56
- """
57
- >>> int_even(-629738975)
58
- False
59
- >>> int_even(-418984868)
60
- True
61
- """
62
-
63
- if x % 2 == 0:
64
- return True
65
- else:
66
- return False
67
-
68
-
69
- def bin_and_bad_generated_function(a: bool, b: bool):
70
- """
71
- >>> bin_and_bad_generated_function(False, False)
72
- False
73
- >>> bin_and_bad_generated_function(True, True)
74
- True
75
- >>> bin_and_bad_generated_function(True, False)
76
- True
77
- >>> bin_and_bad_generated_function(False, True)
78
- True
79
- """
80
-
81
- if a == True:
82
- if b == True:
83
- return True
84
- else:
85
- return True
86
- else:
87
- if b == True:
88
- return True
89
- else:
90
- return False
91
-
92
-
93
- def bin_nand_generated_function(a: bool, b: bool):
94
- """
95
- >>> bin_nand_generated_function(True, False)
96
- True
97
- >>> bin_nand_generated_function(False, False)
98
- True
99
- >>> bin_nand_generated_function(False, True)
100
- True
101
- >>> bin_nand_generated_function(True, True)
102
- False
103
- """
104
-
105
- if a == True:
106
- if b == True:
107
- return False
108
- else:
109
- return True
110
- else:
111
- if b == True:
112
- return True
113
- else:
114
- return True
115
-
116
-
117
- def bin_nor_generated_function(a: bool, b: bool):
118
- """
119
- >>> bin_nor_generated_function(False, False)
120
- True
121
- >>> bin_nor_generated_function(True, False)
122
- False
123
- >>> bin_nor_generated_function(False, True)
124
- False
125
- """
126
-
127
- if a == True:
128
- if b == True:
129
- return False
130
- else:
131
- return False
132
- else:
133
- if b == True:
134
- return False
135
- else:
136
- return True
137
-
138
-
139
- def bin_or_generated_function(a: bool, b: bool):
140
- """
141
- >>> bin_or_generated_function(False, False)
142
- False
143
- >>> bin_or_generated_function(False, True)
144
- True
145
- >>> bin_or_generated_function(True, False)
146
- True
147
- """
148
-
149
- if a == True:
150
- if b == True:
151
- return True
152
- else:
153
- return True
154
- else:
155
- if b == True:
156
- return True
157
- else:
158
- return False
159
-
160
-
161
- def bin_or_bad_generated_function(a: bool, b: bool):
162
- """
163
- >>> bin_or_bad_generated_function(False, False)
164
- True
165
- >>> bin_or_bad_generated_function(True, True)
166
- False
167
- >>> bin_or_bad_generated_function(True, False)
168
- False
169
- >>> bin_or_bad_generated_function(False, True)
170
- False
171
- """
172
-
173
- if a == True:
174
- if b == True:
175
- return False
176
- else:
177
- return False
178
- else:
179
- if b == True:
180
- return False
181
- else:
182
- return True
183
-
184
-
185
- def bin_xor_generated_function(a: bool, b: bool):
186
- """
187
- >>> bin_xor_generated_function(False, False)
188
- False
189
- >>> bin_xor_generated_function(False, True)
190
- True
191
- >>> bin_xor_generated_function(True, True)
192
- False
193
- """
194
-
195
- if a == True:
196
- if b == True:
197
- return False
198
- else:
199
- return True
200
- else:
201
- if b == True:
202
- return True
203
- else:
204
- return False
205
-
206
-
207
- def mux_generated_function(c1: bool, c2: bool, x0: bool, x1: bool, x2: bool, x3: bool):
208
- if c1 == True:
209
- if c2 == True:
210
- if x0 == True:
211
- if x1 == True:
212
- if x2 == True:
213
- if x3 == True:
214
- return True
215
- else:
216
- return True
217
- else:
218
- if x3 == True:
219
- return True
220
- else:
221
- return True
222
- else:
223
- if x2 == True:
224
- if x3 == True:
225
- return True
226
- else:
227
- return True
228
- else:
229
- if x3 == True:
230
- return True
231
- else:
232
- return True
233
- else:
234
- if x1 == True:
235
- if x2 == True:
236
- if x3 == True:
237
- return False
238
- else:
239
- return False
240
- else:
241
- if x3 == True:
242
- return False
243
- else:
244
- return False
245
- else:
246
- if x2 == True:
247
- if x3 == True:
248
- return False
249
- else:
250
- return False
251
- else:
252
- if x3 == True:
253
- return False
254
- else:
255
- return False
256
- else:
257
- if x0 == True:
258
- if x1 == True:
259
- if x2 == True:
260
- if x3 == True:
261
- return True
262
- else:
263
- return True
264
- else:
265
- if x3 == True:
266
- return True
267
- else:
268
- return True
269
- else:
270
- if x2 == True:
271
- if x3 == True:
272
- return False
273
- else:
274
- return False
275
- else:
276
- if x3 == True:
277
- return False
278
- else:
279
- return False
280
- else:
281
- if x1 == True:
282
- if x2 == True:
283
- if x3 == True:
284
- return True
285
- else:
286
- return True
287
- else:
288
- if x3 == True:
289
- return True
290
- else:
291
- return True
292
- else:
293
- if x2 == True:
294
- if x3 == True:
295
- return False
296
- else:
297
- return False
298
- else:
299
- if x3 == True:
300
- return False
301
- else:
302
- return False
303
- else:
304
- if c2 == True:
305
- if x0 == True:
306
- if x1 == True:
307
- if x2 == True:
308
- if x3 == True:
309
- return True
310
- else:
311
- return True
312
- else:
313
- if x3 == True:
314
- return False
315
- else:
316
- return False
317
- else:
318
- if x2 == True:
319
- if x3 == True:
320
- return True
321
- else:
322
- return True
323
- else:
324
- if x3 == True:
325
- return False
326
- else:
327
- return False
328
- else:
329
- if x1 == True:
330
- if x2 == True:
331
- if x3 == True:
332
- return True
333
- else:
334
- return True
335
- else:
336
- if x3 == True:
337
- return False
338
- else:
339
- return False
340
- else:
341
- if x2 == True:
342
- if x3 == True:
343
- return True
344
- else:
345
- return True
346
- else:
347
- if x3 == True:
348
- return False
349
- else:
350
- return False
351
- else:
352
- if x0 == True:
353
- if x1 == True:
354
- if x2 == True:
355
- if x3 == True:
356
- return True
357
- else:
358
- return False
359
- else:
360
- if x3 == True:
361
- return True
362
- else:
363
- return False
364
- else:
365
- if x2 == True:
366
- if x3 == True:
367
- return True
368
- else:
369
- return False
370
- else:
371
- if x3 == True:
372
- return True
373
- else:
374
- return False
375
- else:
376
- if x1 == True:
377
- if x2 == True:
378
- if x3 == True:
379
- return True
380
- else:
381
- return False
382
- else:
383
- if x3 == True:
384
- return True
385
- else:
386
- return False
387
- else:
388
- if x2 == True:
389
- if x3 == True:
390
- return True
391
- else:
392
- return False
393
- else:
394
- if x3 == True:
395
- return True
396
- else:
397
- return False
@@ -1,57 +0,0 @@
1
- def password_strength(pwd: str) ->str:
2
- """>>> password_strength('abc')
3
- 'weak'"""
4
- if len(pwd) < 6:
5
- return 'weak'
6
- elif len(pwd) < 10:
7
- if any(c.isdigit() for c in pwd):
8
- return 'medium'
9
- else:
10
- return 'weak'
11
- elif any(c.isdigit() for c in pwd) and any(c.isupper() for c in pwd):
12
- return 'strong'
13
- else:
14
- return 'medium'
15
-
16
-
17
- def email_type(email: str) ->str:
18
- """>>> email_type('abc')
19
- 'invalid'"""
20
- if not email or '@' not in email:
21
- return 'invalid'
22
- elif email.endswith('@school.edu'):
23
- return 'school'
24
- elif email.endswith('@company.com'):
25
- return 'work'
26
- elif email.endswith('@gmail.com') or email.endswith('@yahoo.com'):
27
- return 'personal'
28
- else:
29
- return 'unknown'
30
-
31
-
32
- def http_code(code: int) ->str:
33
- """>>> http_code(85)
34
- 'invalid'"""
35
- if code < 100 or code > 599:
36
- return 'invalid'
37
- elif 100 <= code < 200:
38
- return 'informational'
39
- elif 200 <= code < 300:
40
- return 'success'
41
- elif 300 <= code < 400:
42
- return 'redirection'
43
- elif 400 <= code < 500:
44
- return 'client error'
45
- else:
46
- return 'server error'
47
-
48
-
49
- def add_or_subtract(x: int, y: int) ->int:
50
- """>>> add_or_subtract(87, 100)
51
- 187"""
52
- result = x
53
- if x < y:
54
- result += y
55
- else:
56
- result -= y
57
- return result
@@ -1,47 +0,0 @@
1
- def categorize_number(n: int) -> str:
2
- if n < 0:
3
- return "negative"
4
- elif n == 0:
5
- return "zero"
6
- elif 0 < n < 10:
7
- return "small"
8
- elif 10 <= n < 100:
9
- return "medium"
10
- else:
11
- return "large"
12
-
13
- def complex_divide(a: int, b: int) -> float:
14
- if b == 0:
15
- return float("inf")
16
- elif a == 0:
17
- return 0.0
18
- elif a == b:
19
- return 1.0
20
- elif a > b:
21
- return a / b
22
- else:
23
- return -1 * (a / b)
24
-
25
- def pos_or_neg(i: int) -> int:
26
- if i > 0:
27
- sgn = 1
28
- else:
29
- sgn = -1
30
- if sgn > 0:
31
- return 1
32
- elif sgn < 0:
33
- return -1
34
-
35
- def is_even(x: int) -> bool:
36
- if x % 2 == 0:
37
- return True
38
- else:
39
- return False
40
-
41
- def is_odd(x: int) -> bool:
42
- if x % 2 != 0:
43
- return True
44
- else:
45
- return False
46
-
47
-
@@ -1,35 +0,0 @@
1
- def bin_and(a, b):
2
- if a == True:
3
- if b == True:
4
- return True
5
- else:
6
- return False
7
- else:
8
- return False
9
-
10
-
11
- def bin_xor(a, b):
12
- if a == True:
13
- if b == True:
14
- return False
15
- else:
16
- return True
17
- elif b == True:
18
- return True
19
- else:
20
- return False
21
-
22
-
23
- def status_flags(active, verified, admin):
24
- if admin:
25
- if verified:
26
- return 'admin-verified'
27
- else:
28
- return 'admin-unverified'
29
- elif active:
30
- if verified:
31
- return 'user-verified'
32
- else:
33
- return 'user-unverified'
34
- else:
35
- return 'inactive'
@@ -1,141 +0,0 @@
1
- from typing import List
2
-
3
- class SampleCodeBin:
4
- def bin_and(self, a: bool, b: bool) -> bool:
5
- """
6
- >>> SampleCodeBin().bin_and(False, False)
7
- False
8
- """
9
- return a and b
10
-
11
- def bin_or(self, a: bool, b: bool) -> bool:
12
- """
13
- >>> SampleCodeBin().bin_or(False, False)
14
- False
15
- """
16
- return a | b
17
-
18
- def bin_xor(self, a: bool, b: bool) -> bool:
19
- """
20
- >>> SampleCodeBin().bin_xor(True, True)
21
- False
22
- """
23
- return a ^ b
24
-
25
- def bin_nand(self, a: bool, b: bool) -> bool:
26
- """
27
- >>> SampleCodeBin().bin_nand(True, False)
28
- True
29
- """
30
- return not(a and b)
31
-
32
- def bin_nor(self, a: bool, b:bool) -> bool:
33
- """
34
- >>> SampleCodeBin().bin_nor(True, False)
35
- False
36
- """
37
- return not(a | b)
38
-
39
- def mux(self, c1: bool, c2: bool, x0: bool, x1: bool, x2: bool, x3: bool) -> bool:
40
- """
41
- >>> SampleCodeBin().mux(True, True, True, False, True, False)
42
- True
43
- """
44
- return (c1 and c2 and x0) | (c1 and (not(c2)) and x1) | (not(c1) and c2 and x2) | (not(c1) and not(c2) and x3)
45
-
46
- def bin_and_bad(self, a: bool, b: bool) -> bool:
47
- """
48
- >>> SampleCodeBin().bin_and_bad(True, True)
49
- True
50
- >>> SampleCodeBin().bin_and_bad(False, True)
51
- True
52
- """
53
- if(a == True and b == True):
54
- return a and b
55
- return a or b
56
-
57
- def bin_or_bad(self, a: bool, b: bool) -> bool:
58
- """
59
- >>> SampleCodeBin().bin_or_bad(False, False)
60
- True
61
- """
62
- return not(a | b)
63
-
64
- """def bit_converter_excep(self, num: int) -> List[int]:
65
- # binary_str: str = bin(num)[2:]
66
- bs = bin(num)
67
- binary_str = bs[2:]
68
- try:
69
- return [int(digit) for digit in binary_str]
70
- except Exception as e:
71
- print(binary_str)
72
- print(bs)
73
- print(f"Invalid Literal Exception in Bit Converter: {e}")
74
- return
75
-
76
- def bit_converter(self, num: int) -> List[int]:
77
- binary_str: str = bin(num)[2:]
78
- return [int(digit) for digit in binary_str]
79
-
80
- def half_adder(self, a: bool, b: bool) -> tuple:
81
- sum: bool = self.bin_xor(a, b)
82
- carry: bool = self.bin_and(a, b)
83
- return (sum, carry)
84
-
85
- def full_adder(self, a: bool, b: bool, carry_in: bool) -> tuple:
86
- sum1, carry = self.half_adder(a, b)
87
- sum2, carry_out = self.half_adder(sum1, carry_in)
88
- return (sum2, carry or carry_out)
89
-
90
- def thirty_two_bit_adder_excep(self, x: int, y: int) -> List[int]:
91
- x_bits: List[int] = self.bit_converter(x)
92
- y_bits: List[int] = self.bit_converter(y)
93
- result: List[int] = [0] * 32
94
- carry: bool = False
95
-
96
- for i in range(32):
97
- try:
98
- sum_bit, carry = self.full_adder(x_bits[i], y_bits[i], carry)
99
- result[i] = sum_bit
100
- except IndexError as e:
101
- print(f"Index Out of Bounds Error In ThirtyTwoBitAdder: {e}")
102
- result = [1] * 32
103
-
104
- if carry:
105
- return OverflowError("Sum exceeds 32 bits")
106
-
107
- return result
108
-
109
- def thirty_two_bit_adder(self, x: int, y: int) -> List[int]:
110
- print(x.bit_length() - 1)
111
- print(y.bit_length() -1)
112
- x_bits: List[int] = self.bit_converter(x)
113
- y_bits: List[int] = self.bit_converter(y)
114
-
115
- #if(len(x_bits) > 32 or len(y_bits) >= 32):
116
- # print(f"Length of bit list greater than 32")
117
-
118
- result: List[int] = [0] * 32
119
- carry: bool = False
120
-
121
- for i in range(32):
122
- sum_bit, carry = self.full_adder(x_bits[i], y_bits[i], carry)
123
- result[i] = sum_bit
124
-
125
- return result
126
-
127
-
128
- def thirty_two_bit_adder_excep(self, x: int, y: int) -> List[int]:
129
- #print(x.bit_length - 1)
130
- #peint(x.bit_length - 1)
131
- x_bits: List[int] = self.bit_converter(x)
132
- y_bits: List[int] = self.bit_converter(y)
133
-
134
- result: List[int] = [0] * 32
135
- carry: bool = False
136
-
137
- for i in range(32):
138
- sum_bit, carry = self.full_adder(x_bits[i], y_bits[i], carry)
139
- result[i] = sum_bit
140
-
141
- return result"""