BEGIN;
    -- Load the TAP functions.
    CREATE EXTENSION pgtap;
    SET client_min_messages TO warning;

    -- Plan the tests.

    SELECT plan(10);

    -- Add data

    \i xt/data/42-pg/Base.sql

    -- Validate required tables

--    SELECT has_table('business');

    -- Validate required functions

    SELECT has_function('journal__add',ARRAY['text','text','integer','date','boolean','boolean','text']);
    SELECT has_function('journal__add_line',ARRAY['integer','integer','numeric', 'numeric', 'text', 'boolean','text','integer[]']);
    SELECT has_function('journal__delete',ARRAY['integer']);
    SELECT has_function('journal__get_entry',ARRAY['integer']);
    SELECT has_function('journal__get_invoice',ARRAY['integer']);
    SELECT has_function('journal__lines',ARRAY['integer']);
    SELECT has_function('journal__make_invoice',ARRAY['integer','integer','boolean','boolean','integer','character varying']);
--  SELECT has_function('journal__save_recurring',ARRAY['text','date','interval','integer','integer']);
    SELECT has_function('journal__save_recurring_print',ARRAY['integer','text','text']);
--  SELECT has_function('journal__increment_recurring',ARRAY['integer','date']);
    SELECT has_function('journal__search',ARRAY['text','text','integer','date','boolean','boolean','text','integer','boolean']);
    SELECT has_function('journal__validate_entry',ARRAY['integer']);

    -- Run tests

--    PREPARE test AS select ...;
--    SELECT results_eq('test',result,'Description');
--    DEALLOCATE test;

    -- Finish the tests and clean up.
    SELECT * FROM finish();

ROLLBACK;
