6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_1362_test.py

79 lines
2.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_1362
# title: Too large numbers cause positive infinity to be inserted into database
# decription:
# tracker_id: CORE-1362
# min_versions: []
# versions: 2.5.0, 4.0
2021-04-26 20:07:00 +02:00
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 2.5.0
2021-04-26 20:07:00 +02:00
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
recreate table test (col1 double precision);
commit;
-- this should PASS:
insert into test values( 1.79769313486231570E+308 );
-- this is too big, should raise exception:
insert into test values( 1.79769313486232e+308 );
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stderr_1 = """
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5.0,<4.0')
2021-04-28 12:42:11 +02:00
def test_1(act_1: Action):
2021-04-26 20:07:00 +02:00
act_1.expected_stderr = expected_stderr_1
act_1.execute()
2021-12-22 20:23:11 +01:00
assert act_1.clean_stderr == act_1.clean_expected_stderr
2021-04-26 20:07:00 +02:00
# version: 4.0
# resources: None
substitutions_2 = []
init_script_2 = """"""
db_2 = db_factory(sql_dialect=3, init=init_script_2)
test_script_2 = """
recreate table test (col1 double precision);
commit;
-- this should PASS:
insert into test values( 1.79769313486231570E+308 );
-- this is too big, should raise exception:
insert into test values( 1.79769313486232e+308 );
commit;
"""
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
expected_stderr_2 = """
Statement failed, SQLSTATE = 22003
Floating-point overflow. The exponent of a floating-point operation is greater than the magnitude allowed.
"""
@pytest.mark.version('>=4.0')
def test_2(act_2: Action):
act_2.expected_stderr = expected_stderr_2
act_2.execute()
assert act_2.clean_stderr == act_2.clean_expected_stderr