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

Added/Updated functional\gtcs\test_external_file_06_d.py. Checked on 3.0.8.33535, 4.0.1.2692, 5.0.0.591

This commit is contained in:
zotov 2022-07-31 11:04:11 +03:00
parent c3c07c64c5
commit 5da08d29c5

View File

@ -8,66 +8,61 @@ DESCRIPTION:
Original test see in:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/EXT_REL_0_6_D.script
NOTES:
[03.03.2021]
[03.03.2021] pzotov
Added substitution for zero value ('F02') as result of evaluating exp(-745.1332192):
on Windows number of digits in decimal representation more than on Linux for 1.
NOTES:
[31.07.2022] pzotov
1. FB config must allow creation of external tables, check parameter 'ExternalFileAccess'.
Otherwise: SQLSTATE = 28000 / Use of external file at location ... is not allowed ...
2. REMOVED evaluation of exp(-745.***) because results depends on CPU (intel vs AMD).
Checked on 3.0.8.33535, 4.0.1.2692, 5.0.0.591
"""
from pathlib import Path
import pytest
from firebird.qa import *
db = db_factory()
act = python_act('db', substitutions=[('[ \t]+', ' '), ('0.0000000000000000', '0.000000000000000')])
act = python_act('db', substitutions=[('[ \t]+', ' '), ('(INPUT|OUTPUT)\\s+message .*', ''), (':\\s+(name:|table:)\\s+.*', '') ])
tmp_ext_file = temp_file('tmp_gtcs_external_file_06_double_precision.dat')
expected_stderr = """
"""
expected_stdout = """
F01 4.940656458412465e-324
F02 0.0000000000000000
F03 1.797693134862273e+308
01: sqltype: 480 DOUBLE Nullable scale: 0 subtype: 0 len: 8
02: sqltype: 480 DOUBLE Nullable scale: 0 subtype: 0 len: 8
F01 3.141592653589793
F02 2.718281828459045
Records affected: 1
"""
@pytest.mark.skip('FIXME: Not IMPLEMENTED')
@pytest.mark.version('>=3.0')
def test_1(act: Action):
pytest.fail("Not IMPLEMENTED")
def test_1(act: Action, tmp_ext_file: Path):
sql_cmd = f'''
create domain dm_dp double precision;
create table ext_table external file '{str(tmp_ext_file)}' (f01 dm_dp, f02 dm_dp);
commit;
insert into ext_table (f01, f02) values( pi(), exp(1) );
commit;
set list on;
set count on;
set sqlda_display on;
select * from ext_table;
commit;
drop table ext_table;
exit;
'''
# test_script_1
#---
#
# import os
# import sys
# import subprocess
# import time
#
# tmp_file = os.path.join(context['temp_directory'],'tmp_ext_06_d.tmp')
# if os.path.isfile( tmp_file):
# os.remove( tmp_file )
#
# this_fdb = db_conn.database_name
#
# sql_cmd='''
# connect 'localhost:%(this_fdb)s' user '%(user_name)s' password '%(user_password)s';
# create domain dm_dp double precision;
# create table ext_table external file '%(tmp_file)s' (f01 dm_dp, f02 dm_dp, f03 dm_dp);
# commit;
# insert into ext_table (f01, f02, f03) values( exp(-745.1332191), exp(-745.1332192), exp(709.78271289338404) );
# commit;
# -- connect 'localhost:%(this_fdb)s' user '%(user_name)s' password '%(user_password)s';
# set list on;
# set count on;
# select * from ext_table;
# ''' % dict(globals(), **locals())
#
# runProgram('isql', [ '-q' ], sql_cmd)
#
# f_sql_chk = open( os.path.join(context['temp_directory'],'tmp_ext_06_d.sql'), 'w')
# f_sql_chk.write(sql_cmd)
# f_sql_chk.close()
#
# time.sleep(1)
#
# os.remove(f_sql_chk.name)
# os.remove( tmp_file )
#
#---
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.isql(switches=['-q'], input = sql_cmd )
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)