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

Add a test tests/bugs/gh_6987_test.py from fbtest.

This commit is contained in:
Anton Zuev 2023-03-10 15:51:08 +03:00
parent bc76b654c8
commit 6f6a80883a

View File

@ -0,0 +1,53 @@
#coding:utf-8
"""
ID: issue-6987
ISSUE: 6987
TITLE: DATEDIFF does not support fractional value for MILLISECOND
DESCRIPTION:
FBTEST: bugs.gh_6987
"""
import pytest
from firebird.qa import *
db = db_factory()
test_script = """
set sqlda_display on;
set list on;
select datediff(millisecond from timestamp '0001-01-01' to timestamp '0001-01-01 00:00:00.0001') dd_01 from rdb$database;
select datediff(millisecond from timestamp '9999-12-31 23:59:59.9999' to timestamp '0001-01-01 00:00:00.0001') dd_02 from rdb$database;
select datediff(millisecond from time '00:00:00' to time '00:00:00.0001') dd_03 from rdb$database;
select datediff(millisecond from time '23:59:59' to time '00:00:00.0001') dd_04 from rdb$database;
"""
act = isql_act('db', test_script, substitutions=[('^((?!sqltype:|DD_).)*$',''),('[ \t]+',' '),('.*alias:.*','')])
expected_stdout = """
01: sqltype: 580 INT64 scale: -1 subtype: 0 len: 8
: name: DATEDIFF alias: DD_01
: table: owner:
DD_01 0.1
01: sqltype: 580 INT64 scale: -1 subtype: 0 len: 8
: name: DATEDIFF alias: DD_02
DD_02 -315537897599999.8
01: sqltype: 580 INT64 scale: -1 subtype: 0 len: 8
: name: DATEDIFF alias: DD_03
DD_03 0.1
01: sqltype: 580 INT64 scale: -1 subtype: 0 len: 8
: name: DATEDIFF alias: DD_04
DD_04 -86398999.9
"""
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute(combine_output=True)
assert act.clean_stdout == act.clean_expected_stdout