2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
#
|
|
|
|
# id: functional.gtcs.computed_fields_12
|
|
|
|
# title: computed-fields-12
|
|
|
|
# decription:
|
|
|
|
# Original test see in:
|
|
|
|
# https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/CF_ISQL_12.script
|
|
|
|
# SQL script for creating test database ('gtcs_sp1.fbk') and fill it with some data:
|
|
|
|
# https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/PROCS_QA_INIT_ISQL.script
|
|
|
|
# Checked on: 4.0.0.1803 SS; 3.0.6.33265 SS; 2.5.9.27149 SC.
|
|
|
|
#
|
|
|
|
# tracker_id:
|
|
|
|
# min_versions: ['2.5.0']
|
|
|
|
# versions: 2.5
|
|
|
|
# qmid: None
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
from firebird.qa import db_factory, isql_act, Action
|
|
|
|
|
|
|
|
# version: 2.5
|
|
|
|
# resources: None
|
|
|
|
|
|
|
|
substitutions_1 = [('[ \t]+', ' ')]
|
|
|
|
|
|
|
|
init_script_1 = """"""
|
|
|
|
|
|
|
|
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
|
|
|
|
|
|
|
test_script_1 = """
|
|
|
|
set heading off;
|
|
|
|
set list on;
|
|
|
|
/*---------------------------------------------*/
|
|
|
|
/* Computed field using another computed field */
|
|
|
|
/*---------------------------------------------*/
|
|
|
|
create table t3 (a integer, af computed by (a*3), afaf computed by (af*2));
|
|
|
|
insert into t3(a) values(10);
|
|
|
|
|
|
|
|
set count on;
|
|
|
|
select * from t3;
|
|
|
|
"""
|
|
|
|
|
|
|
|
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
|
|
|
|
|
|
|
expected_stdout_1 = """
|
|
|
|
A 10
|
|
|
|
AF 30
|
|
|
|
AFAF 60
|
|
|
|
Records affected: 1
|
|
|
|
"""
|
|
|
|
|
|
|
|
@pytest.mark.version('>=2.5')
|
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_stdout = expected_stdout_1
|
|
|
|
act_1.execute()
|
|
|
|
assert act_1.clean_expected_stdout == act_1.clean_stdout
|
|
|
|
|