-- Test to_price set client_min_messages to warning; create extension if not exists pgtap; reset client_min_messages; begin; select plan(23); set search_path to numerus, public; select has_function('numerus', 'to_price', array ['integer', 'integer']); select function_lang_is('numerus', 'to_price', array ['integer', 'integer'], 'plpgsql'); select function_returns('numerus', 'to_price', array ['integer', 'integer'], 'text'); select isnt_definer('numerus', 'to_price', array ['integer', 'integer']); select volatility_is('numerus', 'to_price', array ['integer', 'integer'], 'immutable'); select function_privs_are('numerus', 'to_price', array ['integer', 'integer'], 'guest', array []::text[]); select function_privs_are('numerus', 'to_price', array ['integer', 'integer'], 'invoicer', array ['EXECUTE']); select function_privs_are('numerus', 'to_price', array ['integer', 'integer'], 'admin', array ['EXECUTE']); select function_privs_are('numerus', 'to_price', array ['integer', 'integer'], 'authenticator', array []::text[]); select is( to_price(0, 2), '0.00' ); select is( to_price(0, 3), '0.000' ); select is( to_price(1, 2), '0.01' ); select is( to_price(1, 3), '0.001' ); select is( to_price(10, 2), '0.10' ); select is( to_price(10, 3), '0.010' ); select is( to_price(100, 2), '1.00' ); select is( to_price(100, 3), '0.100' ); select is( to_price(110, 2), '1.10' ); select is( to_price(1100, 3), '1.100' ); select is( to_price(12345678, 2), '123456.78' ); select is( to_price(12345678, 3), '12345.678' ); select is( to_price(12345678, 4), '1234.5678' ); select is( to_price(12345678, 5), '123.45678' ); select * from finish(); rollback;