-- Test positive_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('positive_integer');
select domain_type_is('positive_integer', 'integer');

select lives_ok($$ select       1::positive_integer $$);
select lives_ok($$ select       2::positive_integer $$);
select lives_ok($$ select      10::positive_integer $$);
select lives_ok($$ select   31289::positive_integer $$);
select lives_ok($$ select 8891892::positive_integer $$);

select throws_ok(
	$$ select (-1)::positive_integer $$,
	23514, null,
	'No negative numbers allowed'
);

select throws_ok(
	$$ select 0::positive_integer $$,
	23514, null,
	'Zero is also not allowed'
);

select is(
	1.123::positive_integer,
	1::positive_integer,
	'Integers only'
);


select *
from finish();

rollback;
