Skip to content

Commit

Permalink
fix vscode testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Nov 1, 2023
1 parent 6294dd3 commit dc0a30f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"python.testing.unittestArgs": [
"-v",
"-s",
"./test",
"./",
"-p",
"*test.py"
"*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
Expand Down
5 changes: 5 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

try:
import utils # needed by vscode
except:
pass
16 changes: 14 additions & 2 deletions test/test_qlassf_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def test_max_const(self):
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

# TODO: fixed by cast
# TODO: fix cast
# def test_max_const2(self):
# f = "def test(a: Qint4) -> Qint2:\n\treturn max(a,3)"
# f = "def test(a: Qint4) -> Qint4:\n\treturn max(a,3)"
# qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
# compute_and_compare_results(self, qf)

Expand All @@ -95,3 +95,15 @@ def test_max_tuple_const(self):
f = "def test(a: Qint2, b: Qint2) -> Qint2:\n\treturn max((a, b))"
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

# TODO:
# def test_len_of_range(self):
# f = "def test() -> Qint4:\n\treturn len(range(4))"
# qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
# compute_and_compare_results(self, qf)

# TODO:
# def test_range_of_len(self):
# f = "def test(a: Qlist[bool, 3]) -> Qint4:\n\treturn range(len(a))"
# qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
# compute_and_compare_results(self, qf)
11 changes: 4 additions & 7 deletions test/test_qlassf_for_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ def test_for_cond(self):
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)


# TODO: a test to do
# def hash(k: Qint4) -> bool:
# z = 1
# for i in range(3):
# z += i
# return z == 3
def test_for_sum(self):
f = "def hash(k: Qint4) -> bool:\n\tz = 1\n\tfor i in range(3):\n\t\tz += i\n\treturn z == 3"
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

0 comments on commit dc0a30f

Please sign in to comment.