41 lines
1.5 KiB
MySQL
41 lines
1.5 KiB
MySQL
|
-- Test to_integer
|
||
|
set client_min_messages to warning;
|
||
|
create extension if not exists pgtap;
|
||
|
reset client_min_messages;
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
select plan(23);
|
||
|
|
||
|
select has_function('camper', 'to_integer', array ['color']);
|
||
|
select function_lang_is('camper', 'to_integer', array ['color'], 'sql');
|
||
|
select function_returns('camper', 'to_integer', array ['color'], 'integer');
|
||
|
select isnt_definer('camper', 'to_integer', array ['color']);
|
||
|
select volatility_is('camper', 'to_integer', array ['color'], 'immutable');
|
||
|
select function_privs_are('camper', 'to_integer', array ['color'], 'guest', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_integer', array ['color'], 'employee', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_integer', array ['color'], 'admin', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_integer', array ['color'], 'authenticator', array['EXECUTE']);
|
||
|
|
||
|
select is( to_integer('#112233'), 1122867 );
|
||
|
select is( to_integer('#000000'), 0 );
|
||
|
select is( to_integer('#00000f'), 15 );
|
||
|
select is( to_integer('#00000F'), 15 );
|
||
|
select is( to_integer('#0000ff'), 255 );
|
||
|
select is( to_integer('#0000FF'), 255 );
|
||
|
select is( to_integer('#000fff'), 4095 );
|
||
|
select is( to_integer('#000FFF'), 4095 );
|
||
|
select is( to_integer('#00ffff'), 65535 );
|
||
|
select is( to_integer('#00FFFF'), 65535 );
|
||
|
select is( to_integer('#0fffff'), 1048575 );
|
||
|
select is( to_integer('#0FFFFF'), 1048575 );
|
||
|
select is( to_integer('#ffffff'), 16777215 );
|
||
|
select is( to_integer('#FFFFFF'), 16777215 );
|
||
|
|
||
|
select *
|
||
|
from finish();
|
||
|
|
||
|
rollback;
|