6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_6345_test.py

53 lines
1.2 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-6586
ISSUE: 6586
TITLE: Server crashes on overflow of division result
DESCRIPTION:
NOTES:
[27.07.2021]
separated code for FB 4.x+ because of fix #6874
("Literal 65536 (interpreted as int) can not be multiplied by itself w/o cast if result more than 2^63-1"):
no more error with SQLSTATE = 22003 after this fix.
JIRA: CORE-6345
FBTEST: bugs.core_6345
2022-01-27 20:08:36 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set heading off;
2022-01-27 20:08:36 +01:00
select -922337203685477.5808/-1.0 from rdb$database;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
act = isql_act('db', test_script)
# version: 3.0
2021-04-26 20:07:00 +02:00
expected_stderr_1 = """
Statement failed, SQLSTATE = 22003
Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.6,<4.0')
2022-01-27 20:08:36 +01:00
def test_1(act: Action):
act.expected_stderr = expected_stderr_1
act.execute()
assert act.clean_stderr == act.clean_expected_stderr
2021-04-26 20:07:00 +02:00
# version: 4.0
expected_stdout_2 = """
922337203685477.58080
"""
@pytest.mark.version('>=4.0')
2022-01-27 20:08:36 +01:00
def test_2(act: Action):
act.expected_stdout = expected_stdout_2
act.execute()
assert act.clean_stdout == act.clean_expected_stdout