[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2442] trunk



Revision: 2442
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2442&view=rev
Author:   einhverfr
Date:     2009-02-04 17:39:38 +0000 (Wed, 04 Feb 2009)

Log Message:
-----------
Stripped down the Recon tests to those that work, integrated with test suite.

Modified Paths:
--------------
    trunk/sql/modules/Reconciliaton.sql
    trunk/t/43-dbtest.t

Added Paths:
-----------
    trunk/sql/modules/test/Reconciliation.sql

Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql	2009-02-03 22:20:47 UTC (rev 2441)
+++ trunk/sql/modules/Reconciliaton.sql	2009-02-04 17:39:38 UTC (rev 2442)
@@ -311,12 +311,12 @@
 
 		IF in_count = 0 THEN
 			INSERT INTO cr_report_line
-			(report_id, scn, their_balance, our_balance)
+			(report_id, scn, their_balance, our_balance, clear_time)
 			VALUES 
-			(in_report_id, t_scn, in_amount, 0);
+			(in_report_id, t_scn, in_amount, 0, in_date);
 		ELSIF in_count = 1 THEN
 			UPDATE cr_report_line
-			SET their_balance = in_amount
+			SET their_balance = in_amount, clear_time = in_date
 			WHERE n_scn = scn AND report_id = in_report_id
 				AND their_balance = 0;
 		ELSE 
@@ -335,7 +335,8 @@
 
 			ELSIF in_count = 1 THEN -- EXECT MATCH
 				UPDATE cr_report_line
-				SET their_balance = in_amount
+				SET their_balance = in_amount, 
+					clear_time = in_date
 				WHERE in_scn = scn AND report_id = in_report_id
                                 	AND our_value = in_amount 
 					AND their_balance = 0;
@@ -347,6 +348,7 @@
 
 				UPDATE cr_report_line
                                 SET their_balance = in_amount
+					clear_time = in_date
                                 WHERE id = lid;
 				
 			END IF;
@@ -358,11 +360,12 @@
 
 		IF in_count = 0 THEN -- no match
 			INSERT INTO cr_report_line
-			(report_id, scn, their_balance, our_balance)
+			(report_id, scn, their_balance, our_balance, clear_time)
 			VALUES 
-			(in_report_id, t_scn, in_amount, 0);
+			(in_report_id, t_scn, in_amount, 0, in_date);
 		ELSIF in_count = 1 THEN -- perfect match
 			UPDATE cr_report_line SET their_balance = in_amount
+					clear_time = in_date
 			WHERE report_id = in_report_id AND amount = in_amount
                         	AND their_balance = 0;
 		ELSE -- more than one match
@@ -371,6 +374,7 @@
                         	AND their_balance = 0;
 
 			UPDATE cr_report_line SET their_balance = in_amount
+					clear_time = in_date
 			WHERE id = lid;
 			
 		END IF;

Added: trunk/sql/modules/test/Reconciliation.sql
===================================================================
--- trunk/sql/modules/test/Reconciliation.sql	                        (rev 0)
+++ trunk/sql/modules/test/Reconciliation.sql	2009-02-04 17:39:38 UTC (rev 2442)
@@ -0,0 +1,19 @@
+BEGIN;
+\i Base.sql
+
+INSERT INTO chart (id, accno, description, charttype, category)
+values (-100, -100, 'Test acct', 'A', 'A');
+
+INSERT INTO test_result(test_name, success)
+SELECT 'Create Recon Report', 
+	reconciliation__new_report_id(-100, 100, now()::date) > 0;
+
+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;

Modified: trunk/t/43-dbtest.t
===================================================================
--- trunk/t/43-dbtest.t	2009-02-03 22:20:47 UTC (rev 2441)
+++ trunk/t/43-dbtest.t	2009-02-04 17:39:38 UTC (rev 2442)
@@ -5,7 +5,7 @@
 	plan skip_all => 'Skipping all.  Told not to test db.';
 }
 else {
-	plan tests => 55;
+	plan tests => 56;
 	if (defined $ENV{LSMB_NEW_DB}){
 		$ENV{PGDATABASE} = $ENV{LSMB_NEW_DB};
 	}
@@ -14,7 +14,7 @@
         }
 }
 
-my @testscripts = qw(Account Business_type Company Draft Payment 
+my @testscripts = qw(Account Reconciliation Business_type Company Draft Payment 
 			Session Voucher);
 
 chdir 'sql/modules/test/';


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.