#coding:utf-8 """ ID: intfunc.math.acos TITLE: ACOS( <number> ) DESCRIPTION: Returns the arc cosine of a number. Argument to ACOS must be in the range -1 to 1. Returns a value in the range 0 to PI. er. FBTEST: functional.intfunc.math.acos_01 """ import pytest from firebird.qa import db_factory, isql_act, Action db = db_factory() act = isql_act('db', "select cast( ACOS( 1 ) AS DECIMAL(18,15)) from rdb$database;") expected_stdout = """ CAST ===================== 0.000000000000000 """ @pytest.mark.version('>=3') def test_1(act: Action): act.expected_stdout = expected_stdout act.execute() assert act.clean_stdout == act.clean_expected_stdout
create domain dom01g_1 as float; create domain dom01g_2 as long float; create domain dom01g_3 as real; create domain dom01h as double precision; create domain dom01i_1 as blob; create domain dom01i_2 as blob(60,1); commit; set bail off; set list on; set count on; select * from v_test order by dm_name; """ act = isql_act('db', test_script, substitutions=[('^((?!Statement failed|SQL error code).)*$', ''), (' = ', ' '), ('[ \t]+', ' ')]) expected_stdout = """ DM_NAME DOM01A_1 DM_TYPE 7 DM_SUBTYPE 0 DM_FLEN 2 DM_FSCALE 0 DM_FPREC 0 DM_FCSET <null> DM_FCOLL <null> DM_FCHRLEN <null> DM_FNULL <null> DM_FVALID <null> DM_FDEFAULT <null>
""" db = db_factory(init=init_script) test_script = """SET PLAN ON; SELECT t53.ID1, t53.ID2 FROM Table_53 t53 WHERE t53.ID1 BETWEEN 10 and 20 and t53.ID2 <= 5 ORDER BY t53.ID1 ASC, t53.ID2 DESC;""" act = isql_act('db', test_script) expected_stdout = """PLAN SORT (T53 INDEX (I_TABLE_53_ID2_ASC, I_TABLE_53_ID1_ASC)) ID1 ID2 ============ ============ 10 5 10 4 10 3 10 2 10 1 10 0 20 5 20 4 20 3 20 2
commit; recreate table test(id bigint generated always as identity (start with 9223372036854775807 increment by -2147483647) ); insert into test default values; insert into test default values; select 'case-18' as msg, id from test; commit; recreate table test(id bigint generated always as identity (increment by -2147483647) ); insert into test default values; insert into test default values; select 'case-19' as msg, id from test; commit; """ act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')]) expected_stdout = """ case-00 1 1 case-01 1 1 case-02 1 1 case-03 1 1 case-04 1 1 case-05 1 1 case-06 1 1 case-07 1 1 case-08 1 1 case-09 1 1 case-10 9223372036854775807 9223372036854775807 case-11 9223372036854775807 9223372036854775807 case-12 -9223372036854775808 -9223372036854775808