38 lines
1.4 KiB
MySQL
38 lines
1.4 KiB
MySQL
|
-- Test to_color
|
||
|
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(20);
|
||
|
|
||
|
select has_function('camper', 'to_color', array ['integer']);
|
||
|
select function_lang_is('camper', 'to_color', array ['integer'], 'sql');
|
||
|
select function_returns('camper', 'to_color', array ['integer'], 'color');
|
||
|
select isnt_definer('camper', 'to_color', array ['integer']);
|
||
|
select volatility_is('camper', 'to_color', array ['integer'], 'immutable');
|
||
|
select function_privs_are('camper', 'to_color', array ['integer'], 'guest', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_color', array ['integer'], 'employee', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_color', array ['integer'], 'admin', array['EXECUTE']);
|
||
|
select function_privs_are('camper', 'to_color', array ['integer'], 'authenticator', array['EXECUTE']);
|
||
|
|
||
|
select is( to_color(1122867), '#112233');
|
||
|
select is( to_color(0), '#000000');
|
||
|
select is( to_color(15), '#00000f');
|
||
|
select is( to_color(255), '#0000ff');
|
||
|
select is( to_color(4095), '#000fff');
|
||
|
select is( to_color(65535), '#00ffff');
|
||
|
select is( to_color(1048575), '#0fffff');
|
||
|
select is( to_color(16777215), '#ffffff');
|
||
|
select is( to_color(-1), '#ffffff');
|
||
|
select is( to_color(-559038737), '#deadbe');
|
||
|
select is( to_color(-2147483648), '#800000');
|
||
|
|
||
|
select *
|
||
|
from finish();
|
||
|
|
||
|
rollback;
|