summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-10-08 05:33:55 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-10-08 05:33:55 +0000
commitb9a48112b0cdf744e954956f89f6d9d9f583aad7 (patch)
tree9e7fb44b00cdbe88416fbc6fda98266bb161662d /sql
parent3d34f86ae52d46d07ec61dd1ced0bae41055ec13 (diff)
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
Diffstat (limited to 'sql')
-rw-r--r--sql/modules/Location.sql2
-rw-r--r--sql/modules/test/Company.sql35
2 files changed, 36 insertions, 1 deletions
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;