mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated tests\bugs\gh_7599_test.py: Checked on 5.0.0.1066
This commit is contained in:
parent
434b822360
commit
930027a0d5
69
tests/bugs/gh_7599_test.py
Normal file
69
tests/bugs/gh_7599_test.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#coding:utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
ID: issue-7599
|
||||||
|
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7599
|
||||||
|
TITLE: Conversion of text with '\0' to DECFLOAT without errors.
|
||||||
|
DESCRIPTION:
|
||||||
|
Checked on 5.0.0.1066.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from firebird.qa import *
|
||||||
|
|
||||||
|
db = db_factory()
|
||||||
|
|
||||||
|
act = python_act('db')
|
||||||
|
|
||||||
|
expected_stdout = """
|
||||||
|
Statement failed, SQLSTATE = 22018
|
||||||
|
conversion error from string "123#x00321"
|
||||||
|
|
||||||
|
CASE_02 -0E+6111
|
||||||
|
|
||||||
|
Statement failed, SQLSTATE = 22018
|
||||||
|
Decimal float invalid operation. An indeterminant error occurred during an operation.
|
||||||
|
-conversion error from string "<Too long string or can't be translated>"
|
||||||
|
|
||||||
|
CASE_04 0
|
||||||
|
|
||||||
|
Statement failed, SQLSTATE = 22001
|
||||||
|
arithmetic exception, numeric overflow, or string truncation
|
||||||
|
-string right truncation
|
||||||
|
-expected length 1024, actual 1025
|
||||||
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.version('>=5.0')
|
||||||
|
def test_1(act: Action):
|
||||||
|
test_sql = """
|
||||||
|
set list on;
|
||||||
|
--set echo on;
|
||||||
|
|
||||||
|
-- must FAIL with:
|
||||||
|
-- Statement failed, SQLSTATE = 22018
|
||||||
|
-- conversion error from string "123#x00321"
|
||||||
|
select cast( '123' || x'00' || '321' as decfloat(34)) as case_01 from rdb$database;
|
||||||
|
|
||||||
|
-- must PASS with result = -0E+6111
|
||||||
|
select cast('-0000000000000000000000000000000000000000000000000000000000000000000000000000000.E+7000' as decfloat(34)) as case_02 from rdb$database;
|
||||||
|
|
||||||
|
-- must FAIL with:
|
||||||
|
-- Statement failed, SQLSTATE = 22018
|
||||||
|
-- Decimal float invalid operation. An indeterminant error occurred during an operation.
|
||||||
|
-- -conversion error from string "<Too long string or can't be translated>"
|
||||||
|
select cast( '0000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000.E+0' as decfloat(34)) as case_03 from rdb$database;
|
||||||
|
|
||||||
|
-- must PASS with result = 0
|
||||||
|
select cast( '0.E0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' as decfloat(34)) as case_04 from rdb$database;
|
||||||
|
|
||||||
|
-- must FAIL with
|
||||||
|
-- Statement failed, SQLSTATE = 22001
|
||||||
|
-- arithmetic exception, numeric overflow, or string truncation
|
||||||
|
-- -string right truncation
|
||||||
|
-- -expected length 1024, actual 1025
|
||||||
|
select cast( '0.E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' as decfloat(34)) as case_05 from rdb$database;
|
||||||
|
|
||||||
|
"""
|
||||||
|
act.expected_stdout = expected_stdout
|
||||||
|
act.isql(switches=['-q'], input = test_sql, combine_output = True)
|
||||||
|
assert act.clean_stdout == act.clean_expected_stdout
|
Loading…
Reference in New Issue
Block a user