From b9a48112b0cdf744e954956f89f6d9d9f583aad7 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Wed, 8 Oct 2008 05:33:55 +0000 Subject: Added test cases, verified data structure matches older structure git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2358 4979c152-3d1c-0410-bac9-87ea11338e46 --- sql/modules/Location.sql | 2 +- sql/modules/test/Company.sql | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 sql/modules/test/Company.sql (limited to 'sql') diff --git a/sql/modules/Location.sql b/sql/modules/Location.sql index 4a257e28..cd86dea1 100644 --- a/sql/modules/Location.sql +++ b/sql/modules/Location.sql @@ -158,7 +158,7 @@ CREATE TYPE location_result AS ( state text, mail_code text, country text, - location_class text + class text ); CREATE OR REPLACE FUNCTION location__get(in_id int) returns location_result AS $$ diff --git a/sql/modules/test/Company.sql b/sql/modules/test/Company.sql new file mode 100644 index 00000000..fa95b32a --- /dev/null +++ b/sql/modules/test/Company.sql @@ -0,0 +1,35 @@ +BEGIN; +\i Base.sql + +INSERT INTO test_result (test_name, success) +SELECT 'Saving Company', + company_save (NULL, 'TESTING...', 1,'TESTING', 'TESTING', NULL, '1234') + IS NOT NULL; + + +INSERT INTO test_result (test_name, success) +SELECT 'Saving Credit Acct', + entity_credit_save( NULL , 1, currval('entity_id_seq')::int, 'TEST', 0, false, + 0, 0, 0, 'test-123', NULL, NULL, NULL, 'USD', now()::date, now()::date, + 0, NULL, NULL) + IS NOT NULL; + +INSERT INTO test_result (test_name, success) +SELECT 'eca_location_save', + eca__location_save(currval('entity_credit_account_id_seq')::int, NULL, 2, 'Test', 'Test', + NULL, 'Test', 'Test', '12345', 25) + IS NOT NULL; + +INSERT INTO test_result (test_name, success) +SELECT 'list_locations', count(*) > 0 + FROM eca__list_locations(currval('entity_credit_account_id_seq')::int); + + +SELECT * FROM test_result; + +SELECT (select count(*) from test_result where success is true) +|| ' tests passed and ' +|| (select count(*) from test_result where success is not true) +|| ' failed' as message; + +ROLLBACK; -- cgit v1.2.3