testgenie-py 0.2.0__py3-none-any.whl → 0.2.2__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.
Files changed (33) hide show
  1. testgen/analyzer/random_feedback_analyzer.py +344 -114
  2. testgen/controller/cli_controller.py +5 -10
  3. testgen/controller/docker_controller.py +56 -38
  4. testgen/docker/Dockerfile +19 -10
  5. testgen/generated_samplecodebin.py +545 -0
  6. testgen/generator/code_generator.py +36 -18
  7. testgen/reinforcement/environment.py +1 -1
  8. testgen/service/generator_service.py +16 -1
  9. testgen/service/service.py +124 -32
  10. testgen/sqlite/db_service.py +22 -2
  11. testgen/util/coverage_utils.py +35 -0
  12. testgen/util/file_utils.py +40 -10
  13. testgen/util/randomizer.py +29 -12
  14. {testgenie_py-0.2.0.dist-info → testgenie_py-0.2.2.dist-info}/METADATA +2 -1
  15. {testgenie_py-0.2.0.dist-info → testgenie_py-0.2.2.dist-info}/RECORD +17 -32
  16. testgen/.coverage +0 -0
  17. testgen/code_to_test/__init__.py +0 -0
  18. testgen/code_to_test/boolean.py +0 -146
  19. testgen/code_to_test/calculator.py +0 -29
  20. testgen/code_to_test/code_to_fuzz.py +0 -234
  21. testgen/code_to_test/code_to_fuzz_lite.py +0 -397
  22. testgen/code_to_test/decisions.py +0 -57
  23. testgen/code_to_test/math_utils.py +0 -47
  24. testgen/code_to_test/no_types.py +0 -35
  25. testgen/code_to_test/sample_code_bin.py +0 -141
  26. testgen/docker/poetry.lock +0 -599
  27. testgen/docker/pyproject.toml +0 -29
  28. testgen/q_table/global_q_table.json +0 -1
  29. testgen/testgen.db +0 -0
  30. testgen/tests/__init__.py +0 -0
  31. testgen/tests/test_decisions.py +0 -195
  32. {testgenie_py-0.2.0.dist-info → testgenie_py-0.2.2.dist-info}/WHEEL +0 -0
  33. {testgenie_py-0.2.0.dist-info → testgenie_py-0.2.2.dist-info}/entry_points.txt +0 -0
@@ -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"""