6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_6181_test.py

52 lines
1.6 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-6426
ISSUE: 6426
TITLE: Operations when using "SET DECFLOAT BIND BIGINT,n" with result of 11+ digits,
fail with "Decimal float invalid operation"
2022-01-27 20:08:36 +01:00
DESCRIPTION:
JIRA: CORE-6181
FBTEST: bugs.core_6181
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 list on;
2022-01-27 20:08:36 +01:00
2021-04-26 20:07:00 +02:00
-- OLD SYNTAX: set decfloat bind bigint,3;
-- Syntax after 11-nov-2019:
-- https://github.com/FirebirdSQL/firebird/commit/a77295ba153e0c17061e2230d0ffdbaf08839114
-- See also: doc/sql.extensions/README.set_bind.md:
-- SET BIND OF type-from TO { type-to | LEGACY };
-- SET BIND OF type NATIVE;
set bind of decfloat to numeric(18,3);
select cast('1234567.890' as DECFLOAT(34)) as test_01 from rdb$database;
select cast('1234567.8901' as DECFLOAT(34)) as test_02 from rdb$database;
select cast('12345678.901' as DECFLOAT(34)) as test_03 from rdb$database; -- 12345678.901
select cast('12345678.90' as DECFLOAT(34)) as test_04 from rdb$database; -- Expected result is: 12345678.900
select cast('9223372036854775.807' as DECFLOAT(34)) as test_05 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)
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
TEST_01 1234567.890
TEST_02 1234567.890
TEST_03 12345678.901
TEST_04 12345678.900
TEST_05 9223372036854775.807
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-27 20:08:36 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout