testgenie-py 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/PKG-INFO +1 -1
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/pyproject.toml +2 -2
- testgenie_py-0.1.1/testgen/code_to_test/boolean.py +146 -0
- testgenie_py-0.1.1/testgen/code_to_test/calculator.py +29 -0
- testgenie_py-0.1.1/testgen/code_to_test/code_to_fuzz.py +234 -0
- testgenie_py-0.1.1/testgen/code_to_test/code_to_fuzz_lite.py +397 -0
- testgenie_py-0.1.1/testgen/code_to_test/decisions.py +57 -0
- testgenie_py-0.1.1/testgen/code_to_test/math_utils.py +47 -0
- testgenie_py-0.1.1/testgen/code_to_test/sample_code_bin.py +141 -0
- testgenie_py-0.1.1/testgen/util/z3_utils/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/README.md +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/ast_analyzer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/contracts/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/contracts/contract.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/contracts/no_exception_contract.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/contracts/nonnull_contract.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/fuzz_analyzer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/random_feedback_analyzer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/reinforcement_analyzer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/test_case_analyzer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/test_case_analyzer_context.py +0 -0
- {testgenie_py-0.1.0/testgen/controller → testgenie_py-0.1.1/testgen/code_to_test}/__init__.py +0 -0
- {testgenie_py-0.1.0/testgen/generator → testgenie_py-0.1.1/testgen/controller}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/controller/cli_controller.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/controller/docker_controller.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/docker/Dockerfile +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/docker/poetry.lock +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/docker/pyproject.toml +0 -0
- {testgenie_py-0.1.0/testgen/inspector → testgenie_py-0.1.1/testgen/generator}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/code_generator.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/doctest_generator.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/generator.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/pytest_generator.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/test_generator.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/generator/unit_test_generator.py +0 -0
- {testgenie_py-0.1.0/testgen/models → testgenie_py-0.1.1/testgen/inspector}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/inspector/inspector.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/main.py +0 -0
- {testgenie_py-0.1.0/testgen/presentation → testgenie_py-0.1.1/testgen/models}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/models/analysis_context.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/models/function_metadata.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/models/generator_context.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/models/test_case.py +0 -0
- {testgenie_py-0.1.0/testgen/reinforcement → testgenie_py-0.1.1/testgen/presentation}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/presentation/cli_view.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/q_table/global_q_table.json +0 -0
- {testgenie_py-0.1.0/testgen/service → testgenie_py-0.1.1/testgen/reinforcement}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/reinforcement/abstract_state.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/reinforcement/agent.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/reinforcement/environment.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/reinforcement/statement_coverage_state.py +0 -0
- {testgenie_py-0.1.0/testgen/sqlite → testgenie_py-0.1.1/testgen/service}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/service/analysis_service.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/service/cfg_service.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/service/generator_service.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/service/service.py +0 -0
- {testgenie_py-0.1.0/testgen/tree → testgenie_py-0.1.1/testgen/sqlite}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/sqlite/db.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/sqlite/db_service.py +0 -0
- {testgenie_py-0.1.0/testgen/util → testgenie_py-0.1.1/testgen/tree}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/tree/node.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/tree/tree_utils.py +0 -0
- {testgenie_py-0.1.0/testgen/util/z3_utils → testgenie_py-0.1.1/testgen/util}/__init__.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/coverage_utils.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/coverage_visualizer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/file_utils.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/randomizer.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/utils.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/z3_utils/ast_to_z3.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/z3_utils/branch_condition.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/z3_utils/constraint_extractor.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/z3_utils/variable_finder.py +0 -0
- {testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/util/z3_utils/z3_test_case.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "testgenie-py"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.1"
|
4
4
|
description = ""
|
5
5
|
authors = ["cjseitz <charlesjseitz@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -9,7 +9,7 @@ readme = "README.md"
|
|
9
9
|
include = "testgen"
|
10
10
|
|
11
11
|
[tool.poetry.scripts]
|
12
|
-
testgenie = "main:main"
|
12
|
+
testgenie = "testgen.main:main"
|
13
13
|
|
14
14
|
[tool.poetry.dependencies]
|
15
15
|
python = "^3.10"
|
@@ -0,0 +1,146 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
|
4
|
+
def bin_and(a: bool, b: bool) ->bool:
|
5
|
+
"""
|
6
|
+
>>> bin_and(True, False)
|
7
|
+
False
|
8
|
+
|
9
|
+
>>> bin_and(False, True)
|
10
|
+
False
|
11
|
+
|
12
|
+
>>> bin_and(False, False)
|
13
|
+
False
|
14
|
+
|
15
|
+
>>> bin_and(True, True)
|
16
|
+
True
|
17
|
+
"""
|
18
|
+
if a == True:
|
19
|
+
if b == True:
|
20
|
+
return True
|
21
|
+
else:
|
22
|
+
return False
|
23
|
+
else:
|
24
|
+
return False
|
25
|
+
|
26
|
+
|
27
|
+
def bin_xor(a: bool, b: bool) ->bool:
|
28
|
+
"""
|
29
|
+
>>> bin_xor(True, True)
|
30
|
+
False
|
31
|
+
|
32
|
+
>>> bin_xor(True, False)
|
33
|
+
True
|
34
|
+
|
35
|
+
>>> bin_xor(False, False)
|
36
|
+
False
|
37
|
+
|
38
|
+
>>> bin_xor(False, True)
|
39
|
+
True
|
40
|
+
"""
|
41
|
+
if a == True:
|
42
|
+
if b == True:
|
43
|
+
return False
|
44
|
+
else:
|
45
|
+
return True
|
46
|
+
elif b == True:
|
47
|
+
return True
|
48
|
+
else:
|
49
|
+
return False
|
50
|
+
|
51
|
+
|
52
|
+
def status_flags(active: bool, verified: bool, admin: bool) ->str:
|
53
|
+
"""
|
54
|
+
>>> status_flags(False, False, False)
|
55
|
+
'inactive'
|
56
|
+
|
57
|
+
>>> status_flags(False, False, True)
|
58
|
+
'admin-unverified'
|
59
|
+
|
60
|
+
>>> status_flags(True, True, False)
|
61
|
+
'user-verified'
|
62
|
+
|
63
|
+
>>> status_flags(True, True, True)
|
64
|
+
'admin-verified'
|
65
|
+
|
66
|
+
>>> status_flags(True, False, False)
|
67
|
+
'user-unverified'
|
68
|
+
|
69
|
+
>>> status_flags(False, True, True)
|
70
|
+
'admin-verified'
|
71
|
+
|
72
|
+
>>> status_flags(False, True, False)
|
73
|
+
'inactive'
|
74
|
+
|
75
|
+
>>> status_flags(True, False, True)
|
76
|
+
'admin-unverified'
|
77
|
+
"""
|
78
|
+
if admin:
|
79
|
+
if verified:
|
80
|
+
return 'admin-verified'
|
81
|
+
else:
|
82
|
+
return 'admin-unverified'
|
83
|
+
elif active:
|
84
|
+
if verified:
|
85
|
+
return 'user-verified'
|
86
|
+
else:
|
87
|
+
return 'user-unverified'
|
88
|
+
else:
|
89
|
+
return 'inactive'
|
90
|
+
|
91
|
+
|
92
|
+
"""def half_adder(a: bool, b: bool) ->tuple:
|
93
|
+
sum: bool = bin_xor(a, b)
|
94
|
+
carry: bool = bin_and(a, b)
|
95
|
+
return sum, carry
|
96
|
+
|
97
|
+
|
98
|
+
def full_adder(a: bool, b: bool, carry_in: bool) ->tuple:
|
99
|
+
sum1, carry = half_adder(a, b)
|
100
|
+
sum2, carry_out = half_adder(sum1, carry_in)
|
101
|
+
return sum2, carry or carry_out
|
102
|
+
|
103
|
+
|
104
|
+
def thirty_two_bit_adder_excep(x: int, y: int) ->List[int]:
|
105
|
+
x_bits: List[int] = bit_converter(x)
|
106
|
+
y_bits: List[int] = bit_converter(y)
|
107
|
+
result: List[int] = [0] * 32
|
108
|
+
carry: bool = False
|
109
|
+
for i in range(32):
|
110
|
+
try:
|
111
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
112
|
+
result[i] = sum_bit
|
113
|
+
except IndexError as e:
|
114
|
+
print(f'Index Out of Bounds Error In ThirtyTwoBitAdder: {e}')
|
115
|
+
result = [1] * 32
|
116
|
+
if carry:
|
117
|
+
return OverflowError('Sum exceeds 32 bits')
|
118
|
+
return result
|
119
|
+
|
120
|
+
|
121
|
+
def thirty_two_bit_adder(x: int, y: int) ->List[int]:
|
122
|
+
print(x.bit_length() - 1)
|
123
|
+
print(y.bit_length() - 1)
|
124
|
+
x_bits: List[int] = bit_converter(x)
|
125
|
+
y_bits: List[int] = bit_converter(y)
|
126
|
+
result: List[int] = [0] * 32
|
127
|
+
carry: bool = False
|
128
|
+
for i in range(32):
|
129
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
130
|
+
result[i] = sum_bit
|
131
|
+
return result
|
132
|
+
|
133
|
+
def bit_converter(num: int) ->List[int]:
|
134
|
+
binary_str: str = bin(num)[2:]
|
135
|
+
print(bin(num)[2:])
|
136
|
+
return [int(digit) for digit in binary_str]
|
137
|
+
|
138
|
+
def thirty_two_bit_adder_excep(x: int, y: int) ->List[int]:
|
139
|
+
x_bits: List[int] = bit_converter(x)
|
140
|
+
y_bits: List[int] = bit_converter(y)
|
141
|
+
result: List[int] = [0] * 32
|
142
|
+
carry: bool = False
|
143
|
+
for i in range(32):
|
144
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
145
|
+
result[i] = sum_bit
|
146
|
+
return result"""
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class AdvancedCalculator:
|
2
|
+
|
3
|
+
def evaluate(self, a: int, b: int, op: str) ->(int | float | str):
|
4
|
+
""">>> AdvancedCalculator().evaluate(16, 56, 'abc')
|
5
|
+
'invalid'"""
|
6
|
+
if op == 'add':
|
7
|
+
return a + b
|
8
|
+
elif op == 'sub':
|
9
|
+
return a - b
|
10
|
+
elif op == 'mul':
|
11
|
+
return a * b
|
12
|
+
elif op == 'div':
|
13
|
+
if b == 0:
|
14
|
+
return 'undefined'
|
15
|
+
return a / b
|
16
|
+
else:
|
17
|
+
return 'invalid'
|
18
|
+
|
19
|
+
def is_in_range(self, val: float) ->str:
|
20
|
+
""">>> AdvancedCalculator().is_in_range(0.4023417704905361)
|
21
|
+
'fractional'"""
|
22
|
+
if val < 0.0:
|
23
|
+
return 'below zero'
|
24
|
+
elif 0.0 <= val < 1.0:
|
25
|
+
return 'fractional'
|
26
|
+
elif 1.0 <= val <= 100.0:
|
27
|
+
return 'valid'
|
28
|
+
else:
|
29
|
+
return 'out of range'
|
@@ -0,0 +1,234 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
|
4
|
+
def bin_and(a: bool, b: bool) ->bool:
|
5
|
+
""""
|
6
|
+
>>> bin_and(True, True)
|
7
|
+
True
|
8
|
+
>>> bin_and(True, False)
|
9
|
+
False
|
10
|
+
>>> bin_and(False, True)
|
11
|
+
False
|
12
|
+
>>> bin_and(False, False)
|
13
|
+
False
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
>>> bin_and(True, False)
|
17
|
+
False"""
|
18
|
+
if a == True:
|
19
|
+
if b == True:
|
20
|
+
return True
|
21
|
+
else:
|
22
|
+
return False
|
23
|
+
else:
|
24
|
+
return False
|
25
|
+
|
26
|
+
|
27
|
+
def bin_or(a: bool, b: bool) ->bool:
|
28
|
+
""""
|
29
|
+
>>> bin_or(True, True)
|
30
|
+
True
|
31
|
+
>>> bin_or(True, False)
|
32
|
+
True
|
33
|
+
>>> bin_or(False, True)
|
34
|
+
True
|
35
|
+
>>> bin_or(False, False)
|
36
|
+
False
|
37
|
+
|
38
|
+
Examples:
|
39
|
+
>>> bin_or(False, True)
|
40
|
+
True"""
|
41
|
+
return a | b
|
42
|
+
|
43
|
+
|
44
|
+
def bin_xor(a: bool, b: bool) ->bool:
|
45
|
+
""">>> bin_xor(True, True)
|
46
|
+
False
|
47
|
+
>>> bin_xor(True, False)
|
48
|
+
True
|
49
|
+
>>> bin_xor(False, True)
|
50
|
+
True
|
51
|
+
>>> bin_xor(False, False)
|
52
|
+
False
|
53
|
+
|
54
|
+
Examples:
|
55
|
+
>>> bin_xor(True, True)
|
56
|
+
False"""
|
57
|
+
return a ^ b
|
58
|
+
|
59
|
+
|
60
|
+
def bin_nand(a: bool, b: bool) ->bool:
|
61
|
+
""">>> bin_nand(True, True)
|
62
|
+
False
|
63
|
+
>>> bin_nand(True, False)
|
64
|
+
True
|
65
|
+
>>> bin_nand(False, True)
|
66
|
+
True
|
67
|
+
>>> bin_nand(False, False)
|
68
|
+
True
|
69
|
+
|
70
|
+
Examples:
|
71
|
+
>>> bin_nand(True, False)
|
72
|
+
True"""
|
73
|
+
return not (a and b)
|
74
|
+
|
75
|
+
|
76
|
+
def bin_nor(a: bool, b: bool) ->bool:
|
77
|
+
""">>> bin_nor(True, True)
|
78
|
+
False
|
79
|
+
>>> bin_nor(True, False)
|
80
|
+
False
|
81
|
+
>>> bin_nor(False, True)
|
82
|
+
False
|
83
|
+
>>> bin_nor(False, False)
|
84
|
+
True
|
85
|
+
|
86
|
+
Examples:
|
87
|
+
>>> bin_nor(False, True)
|
88
|
+
False"""
|
89
|
+
return not a | b
|
90
|
+
|
91
|
+
|
92
|
+
def mux(c1: bool, c2: bool, x0: bool, x1: bool, x2: bool, x3: bool) ->bool:
|
93
|
+
""""
|
94
|
+
>>> mux(1, 1, True, False, False, False)
|
95
|
+
True
|
96
|
+
>>> mux(1, 0, False, True, False, False)
|
97
|
+
True
|
98
|
+
>>> mux(0, 1, False, False, True, False)
|
99
|
+
True
|
100
|
+
>>> mux(0, 0, False, False, False, True)
|
101
|
+
True
|
102
|
+
>>> mux(0, 0, False, False, False, False)
|
103
|
+
False
|
104
|
+
|
105
|
+
Examples:
|
106
|
+
>>> mux(False, False, False, False, False, True)
|
107
|
+
True"""
|
108
|
+
return (c1 and c2 and x0) | (c1 and not c2 and x1) | (not c1 and c2 and x2
|
109
|
+
) | (not c1 and not c2 and x3)
|
110
|
+
|
111
|
+
|
112
|
+
def bin_and_bad(a: bool, b: bool) ->bool:
|
113
|
+
""""
|
114
|
+
>>> bin_and(True, True)
|
115
|
+
True
|
116
|
+
>>> bin_and(True, False)
|
117
|
+
False
|
118
|
+
>>> bin_and(False, True)
|
119
|
+
False
|
120
|
+
>>> bin_and(False, False)
|
121
|
+
False
|
122
|
+
|
123
|
+
Examples:
|
124
|
+
>>> bin_and_bad(False, True)
|
125
|
+
True"""
|
126
|
+
if a == True and b == True:
|
127
|
+
return a and b
|
128
|
+
return a or b
|
129
|
+
|
130
|
+
|
131
|
+
def bin_or_bad(a: bool, b: bool) ->bool:
|
132
|
+
""""
|
133
|
+
>>> bin_or(True, True)
|
134
|
+
True
|
135
|
+
>>> bin_or(True, False)
|
136
|
+
True
|
137
|
+
>>> bin_or(False, True)
|
138
|
+
True
|
139
|
+
>>> bin_or(False, False)
|
140
|
+
False
|
141
|
+
|
142
|
+
Examples:
|
143
|
+
>>> bin_or_bad(True, True)
|
144
|
+
False"""
|
145
|
+
return not a | b
|
146
|
+
|
147
|
+
|
148
|
+
def bit_converter_excep(num: int) ->List[int]:
|
149
|
+
""">>> bit_converter_excep(30)
|
150
|
+
[1, 1, 1, 1, 0]"""
|
151
|
+
bs = bin(num)
|
152
|
+
binary_str = bs[2:]
|
153
|
+
try:
|
154
|
+
return [int(digit) for digit in binary_str]
|
155
|
+
except Exception as e:
|
156
|
+
print(binary_str)
|
157
|
+
print(bs)
|
158
|
+
print(f'Invalid Literal Exception in Bit Converter: {e}')
|
159
|
+
return
|
160
|
+
|
161
|
+
|
162
|
+
def bit_converter(num: int) ->List[int]:
|
163
|
+
"""
|
164
|
+
>>> bit_converter(25)
|
165
|
+
[1, 1, 0, 0, 1]
|
166
|
+
"""
|
167
|
+
binary_str: str = bin(num)[2:]
|
168
|
+
print(bin(num)[2:])
|
169
|
+
return [int(digit) for digit in binary_str]
|
170
|
+
|
171
|
+
|
172
|
+
def half_adder(a: bool, b: bool) ->tuple:
|
173
|
+
""">>> half_adder(True, True)
|
174
|
+
(False, True)"""
|
175
|
+
sum: bool = bin_xor(a, b)
|
176
|
+
carry: bool = bin_and(a, b)
|
177
|
+
return sum, carry
|
178
|
+
|
179
|
+
|
180
|
+
def full_adder(a: bool, b: bool, carry_in: bool) ->tuple:
|
181
|
+
""">>> full_adder(True, False, False)
|
182
|
+
(True, False)"""
|
183
|
+
sum1, carry = half_adder(a, b)
|
184
|
+
sum2, carry_out = half_adder(sum1, carry_in)
|
185
|
+
return sum2, carry or carry_out
|
186
|
+
|
187
|
+
|
188
|
+
def thirty_two_bit_adder_excep(x: int, y: int) ->List[int]:
|
189
|
+
""">>> thirty_two_bit_adder_excep(9, 3)
|
190
|
+
None
|
191
|
+
|
192
|
+
Examples:
|
193
|
+
>>> thirty_two_bit_adder_excep(34, 1)
|
194
|
+
None"""
|
195
|
+
x_bits: List[int] = bit_converter(x)
|
196
|
+
y_bits: List[int] = bit_converter(y)
|
197
|
+
result: List[int] = [0] * 32
|
198
|
+
carry: bool = False
|
199
|
+
for i in range(32):
|
200
|
+
try:
|
201
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
202
|
+
result[i] = sum_bit
|
203
|
+
except IndexError as e:
|
204
|
+
print(f'Index Out of Bounds Error In ThirtyTwoBitAdder: {e}')
|
205
|
+
result = [1] * 32
|
206
|
+
if carry:
|
207
|
+
return OverflowError('Sum exceeds 32 bits')
|
208
|
+
return result
|
209
|
+
|
210
|
+
|
211
|
+
def thirty_two_bit_adder(x: int, y: int) ->List[int]:
|
212
|
+
""">>> thirty_two_bit_adder(8, 45)
|
213
|
+
None"""
|
214
|
+
print(x.bit_length() - 1)
|
215
|
+
print(y.bit_length() - 1)
|
216
|
+
x_bits: List[int] = bit_converter(x)
|
217
|
+
y_bits: List[int] = bit_converter(y)
|
218
|
+
result: List[int] = [0] * 32
|
219
|
+
carry: bool = False
|
220
|
+
for i in range(32):
|
221
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
222
|
+
result[i] = sum_bit
|
223
|
+
return result
|
224
|
+
|
225
|
+
|
226
|
+
def thirty_two_bit_adder_excep(x: int, y: int) ->List[int]:
|
227
|
+
x_bits: List[int] = bit_converter(x)
|
228
|
+
y_bits: List[int] = bit_converter(y)
|
229
|
+
result: List[int] = [0] * 32
|
230
|
+
carry: bool = False
|
231
|
+
for i in range(32):
|
232
|
+
sum_bit, carry = full_adder(x_bits[i], y_bits[i], carry)
|
233
|
+
result[i] = sum_bit
|
234
|
+
return result
|
@@ -0,0 +1,397 @@
|
|
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
|
@@ -0,0 +1,57 @@
|
|
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
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
@@ -0,0 +1,141 @@
|
|
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"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{testgenie_py-0.1.0 → testgenie_py-0.1.1}/testgen/analyzer/contracts/no_exception_contract.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{testgenie_py-0.1.0/testgen/controller → testgenie_py-0.1.1/testgen/code_to_test}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{testgenie_py-0.1.0/testgen/reinforcement → testgenie_py-0.1.1/testgen/presentation}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|