[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2363] trunk/sql/modules/test
- Subject: SF.net SVN: ledger-smb:[2363] trunk/sql/modules/test
- From: ..hidden..
- Date: Fri, 10 Oct 2008 18:25:24 +0000
Revision: 2363
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2363&view=rev
Author: einhverfr
Date: 2008-10-10 18:25:24 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
More unit tests for stored procs
Added Paths:
-----------
trunk/sql/modules/test/Account.sql
trunk/sql/modules/test/Business_type.sql
trunk/sql/modules/test/admin.sql
Added: trunk/sql/modules/test/Account.sql
===================================================================
--- trunk/sql/modules/test/Account.sql (rev 0)
+++ trunk/sql/modules/test/Account.sql 2008-10-10 18:25:24 UTC (rev 2363)
@@ -0,0 +1,122 @@
+BEGIN;
+\i Base.sql
+
+
+INSERT INTO chart (description, charttype, category, accno)
+VALUES ('TEST testing 1', 'A', 'A', '00001');
+
+INSERT INTO chart (description, charttype, category, accno)
+VALUES ('TEST testing 2', 'A', 'A', '00002');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP 1', 'A', 'L', '00003', 'AP');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP 2', 'A', 'L', '00004', 'AP');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR 1', 'A', 'A', '00005', 'AR');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR 2', 'A', 'A', '00006', 'AR');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR PAID 1', 'A', 'A', '00007', 'AR_paid');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR PAID 2', 'A', 'A', '00008', 'AR_paid1');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR PAID 3', 'A', 'A', '00009', 'IC_tax:AR_paid');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AR PAID 4 INVALID', 'A', 'A', '00010', 'AR_p');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP PAID 1', 'A', 'A', '00011', 'AP_paid');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP PAID 2', 'A', 'A', '00012', 'AP_paid1');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP PAID 3', 'A', 'A', '00013', 'IC_tax:AP_paid');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP PAID 4 INVALID', 'A', 'A', '00014', 'AP_p');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 1', 'A', 'A', '00015', 'AP_overpayment');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 2', 'A', 'A', '00016', 'AP_overpayment1');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 3', 'A', 'A', '00017', 'IC_tax:AP_overpayment');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 4 INVALID', 'A', 'A', '00018', 'AP_overp');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 1', 'A', 'A', '00019', 'AR_overpayment');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 2', 'A', 'A', '00020', 'AR_overpayment1');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 3', 'A', 'A', '00021', 'IC_tax:AR_overpayment');
+
+INSERT INTO chart (description, charttype, category, accno, link)
+VALUES ('TEST AP Overpayment 4 INVALID', 'A', 'A', '00022', 'AR_overp');
+
+INSERT INTO test_result(test_name, success)
+VALUES ('Accounts created', currval('chart_id_seq') is not null);
+
+INSERT INTO ap (invnumber, netamount, amount) VALUES ('TEST', '0', '0');
+INSERT INTO acc_trans (trans_id, chart_id, amount)
+VALUES (currval('id')::int, currval('chart_id_seq')::int, '0');
+
+INSERT INTO test_result(test_name, success)
+VALUES ('Chart 1 is orphaned', account_is_orphaned((select id from chart where description = 'TEST testing 1')));
+
+INSERT INTO test_result(test_name, success)
+VALUES ('Chart 2 is not orphaned', account_is_orphaned(currval('chart_id_seq')::int) is false);
+
+INSERT INTO test_result(test_name, success)
+SELECT 'All Test Accounts Exist', count(*) = 22 FROM chart_list_all()
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'List AR Cash Test Accounts', count(*) = 3 FROM chart_list_cash(2)
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'List AP Cash Test Accounts', count(*) = 3 FROM chart_list_cash(1)
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'List AP Overpayment Accts', count(*) = 3 FROM chart_list_overpayment(1)
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'List AR Overpayment Accts', count(*) = 3 FROM chart_list_overpayment(2)
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'Test AP Accounts Are Found', count(*) = 2 FROM chart_get_ar_ap(1)
+where accno like '0%' AND description LIKE 'TEST%';
+
+INSERT INTO test_result(test_name, success)
+SELECT 'Test AR Accounts Are Found', count(*) = 2 FROM chart_get_ar_ap(2)
+where accno like '0%' AND description LIKE 'TEST%';
+
+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;
+
+\echo This currently fails 2 tests due to some confusion as to
+\echo account_is_orphaned is supposed to do.
+
+ROLLBACK;
Added: trunk/sql/modules/test/Business_type.sql
===================================================================
--- trunk/sql/modules/test/Business_type.sql (rev 0)
+++ trunk/sql/modules/test/Business_type.sql 2008-10-10 18:25:24 UTC (rev 2363)
@@ -0,0 +1,17 @@
+BEGIN;
+\i Base.sql
+
+INSERT INTO business (description) values ('testing');
+
+INSERT INTO test_result (test_name, success)
+SELECT 'Business Class Inserted', count(*) > 0 from business_type__list()
+WHERE description = 'testing';
+
+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;
Added: trunk/sql/modules/test/admin.sql
===================================================================
--- trunk/sql/modules/test/admin.sql (rev 0)
+++ trunk/sql/modules/test/admin.sql 2008-10-10 18:25:24 UTC (rev 2363)
@@ -0,0 +1,13 @@
+BEGIN;
+\i Base.sql
+
+\echo no tests yet!
+
+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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.