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

38 lines
950 B
Python

#coding:utf-8
"""
ID: intfunc.math.trunc
TITLE: TRUNC( <number> [, <number> ] )
DESCRIPTION: Returns the integral part (up to the specified scale) of a number.
FBTEST: functional.intfunc.math.trunc_01
"""
import pytest
from firebird.qa import *
db = db_factory()
test_script = """
select trunc(-2.8), trunc(2.8) from rdb$database; -- returns -2, 2
select trunc(987.65, 1), trunc(987.65, -1) from rdb$database; -- returns 987.60, 980.00
"""
act = isql_act('db', test_script)
expected_stdout = """
TRUNC TRUNC
===================== =====================
-2 2
TRUNC TRUNC
===================== =====================
987.60 980.00
"""
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout