From b164bcda4d7591768ccc63db6f673655838f6cf5 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Mon, 20 Jun 2022 16:52:06 +0530 Subject: [PATCH] Register the errors --- tests/errors/test_bitwise_on_complex.py | 11 +++++++++++ tests/errors/test_bitwise_on_float.py | 11 +++++++++++ .../asr-test_bitwise_on_complex-dd9568b.json | 13 +++++++++++++ .../asr-test_bitwise_on_complex-dd9568b.stderr | 5 +++++ .../asr-test_bitwise_on_float-2e09b30.json | 13 +++++++++++++ .../asr-test_bitwise_on_float-2e09b30.stderr | 5 +++++ tests/tests.toml | 8 ++++++++ 7 files changed, 66 insertions(+) create mode 100644 tests/errors/test_bitwise_on_complex.py create mode 100644 tests/errors/test_bitwise_on_float.py create mode 100644 tests/reference/asr-test_bitwise_on_complex-dd9568b.json create mode 100644 tests/reference/asr-test_bitwise_on_complex-dd9568b.stderr create mode 100644 tests/reference/asr-test_bitwise_on_float-2e09b30.json create mode 100644 tests/reference/asr-test_bitwise_on_float-2e09b30.stderr diff --git a/tests/errors/test_bitwise_on_complex.py b/tests/errors/test_bitwise_on_complex.py new file mode 100644 index 0000000000..66c48bb0d2 --- /dev/null +++ b/tests/errors/test_bitwise_on_complex.py @@ -0,0 +1,11 @@ +from ltypes import c32 + +def f(): + c1: c32 + c1 = 4+5j + c2: c32 + c2 = -5.6-3j + print(c1 | c2) + + +f() diff --git a/tests/errors/test_bitwise_on_float.py b/tests/errors/test_bitwise_on_float.py new file mode 100644 index 0000000000..1abc611f31 --- /dev/null +++ b/tests/errors/test_bitwise_on_float.py @@ -0,0 +1,11 @@ +from ltypes import f32 + +def f(): + f1: f32 + f1 = 4.5 + f2: f32 + f2 = 6.7 + print(f1 << f2) + + +f() diff --git a/tests/reference/asr-test_bitwise_on_complex-dd9568b.json b/tests/reference/asr-test_bitwise_on_complex-dd9568b.json new file mode 100644 index 0000000000..24a2da2b22 --- /dev/null +++ b/tests/reference/asr-test_bitwise_on_complex-dd9568b.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_bitwise_on_complex-dd9568b", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/errors/test_bitwise_on_complex.py", + "infile_hash": "5e03de6348ffb4fa922d726b314eb95eef2f332404e6be94f0b20139", + "outfile": null, + "outfile_hash": null, + "stdout": null, + "stdout_hash": null, + "stderr": "asr-test_bitwise_on_complex-dd9568b.stderr", + "stderr_hash": "58f7acb7f7187308d38c7c97fcd9e34b2022c42be1b6583b95b379af", + "returncode": 2 +} \ No newline at end of file diff --git a/tests/reference/asr-test_bitwise_on_complex-dd9568b.stderr b/tests/reference/asr-test_bitwise_on_complex-dd9568b.stderr new file mode 100644 index 0000000000..7bb1052707 --- /dev/null +++ b/tests/reference/asr-test_bitwise_on_complex-dd9568b.stderr @@ -0,0 +1,5 @@ +semantic error: Unsupported binary operation on complex: '|' + --> tests/errors/test_bitwise_on_complex.py:8:11 + | +8 | print(c1 | c2) + | ^^^^^^^ diff --git a/tests/reference/asr-test_bitwise_on_float-2e09b30.json b/tests/reference/asr-test_bitwise_on_float-2e09b30.json new file mode 100644 index 0000000000..032da70d00 --- /dev/null +++ b/tests/reference/asr-test_bitwise_on_float-2e09b30.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-test_bitwise_on_float-2e09b30", + "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/errors/test_bitwise_on_float.py", + "infile_hash": "db0fdc79b1041fc5745a4bc839181d870f95d8ebd5169a29530cb178", + "outfile": null, + "outfile_hash": null, + "stdout": null, + "stdout_hash": null, + "stderr": "asr-test_bitwise_on_float-2e09b30.stderr", + "stderr_hash": "1e77fcf2484ec7c10436c14ac2a498db59706d30d3c294b89b6b9090", + "returncode": 2 +} \ No newline at end of file diff --git a/tests/reference/asr-test_bitwise_on_float-2e09b30.stderr b/tests/reference/asr-test_bitwise_on_float-2e09b30.stderr new file mode 100644 index 0000000000..d6733722d6 --- /dev/null +++ b/tests/reference/asr-test_bitwise_on_float-2e09b30.stderr @@ -0,0 +1,5 @@ +semantic error: Unsupported binary operation on floats: '<<' + --> tests/errors/test_bitwise_on_float.py:8:11 + | +8 | print(f1 << f2) + | ^^^^^^^^ diff --git a/tests/tests.toml b/tests/tests.toml index a8cedeb352..52be4f8d21 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -546,6 +546,14 @@ asr = true filename = "errors/test_str_to_int.py" asr = true +[[test]] +filename = "errors/test_bitwise_on_float.py" +asr = true + +[[test]] +filename = "errors/test_bitwise_on_complex.py" +asr = true + # tests/tokens/errors [[test]]