38 lines
882 B
MySQL
38 lines
882 B
MySQL
|
-- Test nonnegative_integer
|
||
|
set client_min_messages to warning;
|
||
|
create extension if not exists pgtap;
|
||
|
reset client_min_messages;
|
||
|
|
||
|
begin;
|
||
|
|
||
|
select plan(10);
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
select has_domain('nonnegative_integer');
|
||
|
select domain_type_is('nonnegative_integer', 'integer');
|
||
|
|
||
|
select lives_ok($$ select 0::nonnegative_integer $$);
|
||
|
select lives_ok($$ select 1::nonnegative_integer $$);
|
||
|
select lives_ok($$ select 2::nonnegative_integer $$);
|
||
|
select lives_ok($$ select 10::nonnegative_integer $$);
|
||
|
select lives_ok($$ select 31289::nonnegative_integer $$);
|
||
|
select lives_ok($$ select 8891892::nonnegative_integer $$);
|
||
|
|
||
|
select throws_ok(
|
||
|
$$ select (-1)::nonnegative_integer $$,
|
||
|
23514, null,
|
||
|
'No negative numbers allowed'
|
||
|
);
|
||
|
|
||
|
select is(
|
||
|
1.123::nonnegative_integer,
|
||
|
1::nonnegative_integer,
|
||
|
'Integers only'
|
||
|
);
|
||
|
|
||
|
select *
|
||
|
from finish();
|
||
|
|
||
|
rollback;
|