[Prolint-cvs] SF.net SVN: prolint: [270] trunk/prolint
Brought to you by:
johnallengreen,
jurjen
From: <ju...@us...> - 2006-08-04 23:04:07
|
Revision: 270 Author: jurjen Date: 2006-08-04 16:03:53 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/prolint/?rev=270&view=rev Log Message: ----------- New database "prolintest". This one is used during regression testing, instead Sports2000. Because the Sports2000 database did not have the indexes needed to test the "findstate" rule. Modified Paths: -------------- trunk/prolint/desktop.w trunk/prolint/regrtest/findstate.i trunk/prolint/test.p Added Paths: ----------- trunk/prolint/regrtest/db/ trunk/prolint/regrtest/db/prolintest.df Modified: trunk/prolint/desktop.w =================================================================== --- trunk/prolint/desktop.w 2006-07-17 21:54:09 UTC (rev 269) +++ trunk/prolint/desktop.w 2006-08-04 23:03:53 UTC (rev 270) @@ -188,7 +188,7 @@ SIZE 52 BY 1.29 BGCOLOR 8 NO-UNDO. -DEFINE VARIABLE EDITOR-9 AS CHARACTER INITIAL "Run regression-tests for Prolint. Needs a connection to sports.db or sports2000.db." +DEFINE VARIABLE EDITOR-9 AS CHARACTER INITIAL "Run regression-tests for Prolint." VIEW-AS EDITOR LARGE NO-BOX SIZE 52 BY 1.33 BGCOLOR 8 NO-UNDO. Added: trunk/prolint/regrtest/db/prolintest.df =================================================================== --- trunk/prolint/regrtest/db/prolintest.df (rev 0) +++ trunk/prolint/regrtest/db/prolintest.df 2006-08-04 23:03:53 UTC (rev 270) @@ -0,0 +1,520 @@ +UPDATE DATABASE "?" + +ADD TABLE "Customer" + DESCRIPTION "The customer table contains customer information including balance and address." + DUMP-NAME "customer" + +ADD FIELD "CustNum" OF "Customer" AS integer + FORMAT ">>>>9" + INITIAL "0" + LABEL "Cust Num" + SQL-WIDTH 4 + VALEXP "custnum > 0" + VALMSG "Customer number must be greater than zero" + HELP "Please enter a customer number." + ORDER 10 + +ADD FIELD "Name" OF "Customer" AS character + FORMAT "x(30)" + INITIAL "" + LABEL "Name" + SQL-WIDTH 60 + HELP "Please enter a name." + ORDER 30 + +ADD FIELD "Address" OF "Customer" AS character + FORMAT "x(35)" + INITIAL "" + LABEL "Address" + SQL-WIDTH 70 + HELP "Please enter an address." + ORDER 40 + +ADD FIELD "Address2" OF "Customer" AS character + FORMAT "x(35)" + INITIAL "" + LABEL "Address2" + SQL-WIDTH 70 + HELP "Please enter an address." + ORDER 50 + +ADD FIELD "City" OF "Customer" AS character + FORMAT "x(25)" + INITIAL "" + LABEL "City" + SQL-WIDTH 50 + HELP "Please enter a city." + ORDER 60 + +ADD FIELD "State" OF "Customer" AS character + DESCRIPTION "Label/Valexp/Valmsg/Help are set based on value of NON-US field!" + FORMAT "x(20)" + INITIAL "" + LABEL "State" + SQL-WIDTH 40 + HELP "Please enter standard state abbreviation." + ORDER 70 + +ADD FIELD "Country" OF "Customer" AS character + FORMAT "x(20)" + INITIAL "USA" + LABEL "Country" + SQL-WIDTH 40 + HELP "Please enter a country." + ORDER 15 + +ADD FIELD "Phone" OF "Customer" AS character + DESCRIPTION "Format/Label/Help based on status of NON-US field." + FORMAT "x(20)" + INITIAL "" + LABEL "Phone" + SQL-WIDTH 40 + HELP "Please enter a phone number" + ORDER 115 + +ADD FIELD "Contact" OF "Customer" AS character + FORMAT "x(30)" + INITIAL "" + LABEL "Contact" + SQL-WIDTH 60 + HELP "Please enter a contact." + ORDER 110 + +ADD FIELD "SalesRep" OF "Customer" AS character + FORMAT "x(4)" + INITIAL "" + LABEL "Sales Rep" + SQL-WIDTH 8 + VALEXP "CAN-FIND(Salesrep OF Customer)" + VALMSG "The Sales Rep's name you've entered must exist in the Salesrep table." + HELP "Please Enter a Sales Rep." + ORDER 125 + +ADD FIELD "Comments" OF "Customer" AS character + FORMAT "x(80)" + INITIAL "" + LABEL "Comments" + SQL-WIDTH 160 + HELP "Please enter comments." + ORDER 180 + +ADD FIELD "CreditLimit" OF "Customer" AS decimal + DESCRIPTION "Maximum credit" + FORMAT "->,>>>,>>9" + INITIAL "1500" + LABEL "Credit Limit" + SQL-WIDTH 17 + VALEXP "CreditLimit >= 0 AND CreditLimit <= 9999999" + VALMSG "Credit Limit must be >= 0 and <= 9,999,999" + HELP "Please enter a Credit Limit." + DECIMALS 2 + ORDER 130 + +ADD FIELD "Balance" OF "Customer" AS decimal + FORMAT "->,>>>,>>9.99" + INITIAL "0" + LABEL "Balance" + SQL-WIDTH 17 + HELP "Please enter a balance." + DECIMALS 2 + ORDER 140 + +ADD FIELD "Terms" OF "Customer" AS character + FORMAT "x(20)" + INITIAL "Net30" + LABEL "Terms" + SQL-WIDTH 40 + HELP "Please enter terms" + ORDER 150 + +ADD FIELD "Discount" OF "Customer" AS integer + FORMAT ">>9%" + INITIAL "0" + LABEL "Discount" + SQL-WIDTH 4 + VALEXP "Discount >= 0" + VALMSG "Discount must be greater or equal to 0" + HELP "Please enter a percentage from 0 to 100." + ORDER 170 + +ADD FIELD "PostalCode" OF "Customer" AS character + DESCRIPTION "Format/Label/Help Message based on status of NON-US field." + FORMAT "x(10)" + INITIAL "" + LABEL "Postal Code" + SQL-WIDTH 20 + HELP "Please enter the appropriate Postal Code." + ORDER 80 + +ADD FIELD "Fax" OF "Customer" AS character + DESCRIPTION "Format/Label/Help based on status of NON-US field." + FORMAT "x(20)" + INITIAL "" + LABEL "Fax" + SQL-WIDTH 40 + HELP "Please enter a fax number." + ORDER 190 + +ADD FIELD "EmailAddress" OF "Customer" AS character + FORMAT "x(50)" + INITIAL "" + LABEL "Email" + SQL-WIDTH 100 + HELP "Please enter an full Internet Email Address." + LENGTH 0 + ORDER 200 + +ADD INDEX "CustNum" ON "Customer" + UNIQUE + PRIMARY + INDEX-FIELD "CustNum" ASCENDING + +ADD INDEX "Comments" ON "Customer" + WORD + INDEX-FIELD "Comments" ASCENDING + +ADD INDEX "CountryPost" ON "Customer" + INDEX-FIELD "Country" ASCENDING + INDEX-FIELD "PostalCode" ASCENDING + +ADD INDEX "Name" ON "Customer" + INDEX-FIELD "Name" ASCENDING + +ADD INDEX "SalesRep" ON "Customer" + INDEX-FIELD "SalesRep" ASCENDING + +ADD TABLE "testtable1" + DUMP-NAME "a" + +ADD FIELD "field1" OF "testtable1" AS integer + FORMAT "->,>>>,>>9" + INITIAL "0" + SQL-WIDTH 4 + ORDER 10 + +ADD FIELD "field2" OF "testtable1" AS logical + FORMAT "yes/no" + INITIAL "no" + SQL-WIDTH 1 + ORDER 20 + +ADD FIELD "field3" OF "testtable1" AS character + FORMAT "X(8)" + INITIAL "" + SQL-WIDTH 16 + ORDER 30 + +ADD FIELD "field4" OF "testtable1" AS character + FORMAT "X(8)" + INITIAL "" + SQL-WIDTH 16 + ORDER 40 + +ADD INDEX "idx1" ON "testtable1" + UNIQUE + PRIMARY + INDEX-FIELD "field1" ASCENDING + INDEX-FIELD "field2" ASCENDING + INDEX-FIELD "field3" ASCENDING + +ADD TABLE "Salesrep" + DESCRIPTION "The salesrep table contains sales representative information" + VALEXP "NOT CAN-FIND(FIRST Customer Of Salesrep)" + VALMSG "Cannot delete if used in one or more customer records." + DUMP-NAME "salesrep" + +ADD FIELD "RepName" OF "Salesrep" AS character + FORMAT "x(30)" + INITIAL "" + LABEL "Rep Name" + SQL-WIDTH 60 + HELP "Please enter the Name of the Salesperson." + ORDER 20 + +ADD FIELD "Region" OF "Salesrep" AS character + FORMAT "x(8)" + INITIAL "" + LABEL "Region" + SQL-WIDTH 16 + HELP "Please enter the Sales Region covered by this salesman." + ORDER 30 + +ADD FIELD "SalesRep" OF "Salesrep" AS character + FORMAT "x(4)" + INITIAL "" + LABEL "Sales Rep" + SQL-WIDTH 8 + HELP "Please enter the Sales Rep." + ORDER 1 + +ADD FIELD "MonthQuota" OF "Salesrep" AS integer + FORMAT "->,>>>,>>9" + INITIAL "0" + LABEL "Month Quota" + SQL-WIDTH 264 + HELP "Please enter the Month Quota." + EXTENT 12 + ORDER 40 + +ADD INDEX "SalesRep" ON "Salesrep" + UNIQUE + PRIMARY + INDEX-FIELD "SalesRep" ASCENDING + +ADD TABLE "Order" + DESCRIPTION "The order table contains order header information." + VALEXP "1 = 1" + DUMP-NAME "order" + +ADD FIELD "Ordernum" OF "Order" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Order Num" + SQL-WIDTH 4 + VALEXP "ordernum > 0" + VALMSG "Order number must be greater than zero" + HELP "Please enter an order number." + ORDER 10 + +ADD FIELD "CustNum" OF "Order" AS integer + DESCRIPTION " Help:Name" + FORMAT ">>>>9" + INITIAL "0" + LABEL "Cust Num" + SQL-WIDTH 4 + VALEXP "CAN-FIND(customer OF order)" + VALMSG "Customer must already exist." + HELP "Please enter an existing customer number." + ORDER 20 + +ADD FIELD "OrderDate" OF "Order" AS date + FORMAT "99/99/99" + INITIAL "TODAY" + LABEL "Ordered" + SQL-WIDTH 4 + HELP "Please enter the date of order." + ORDER 90 + +ADD FIELD "ShipDate" OF "Order" AS date + FORMAT "99/99/9999" + INITIAL ? + LABEL "Shipped" + SQL-WIDTH 4 + HELP "Please enter the ship date." + ORDER 100 + +ADD FIELD "PromiseDate" OF "Order" AS date + FORMAT "99/99/99" + INITIAL ? + LABEL "Promised" + SQL-WIDTH 4 + HELP "Please enter the Promise Date." + ORDER 110 + +ADD FIELD "Carrier" OF "Order" AS character + DESCRIPTION "Should lookup valid carriers." + FORMAT "x(25)" + INITIAL "" + LABEL "Carrier" + SQL-WIDTH 50 + HELP "Please enter the carrier." + ORDER 120 + +ADD FIELD "Instructions" OF "Order" AS character + FORMAT "x(50)" + INITIAL "" + LABEL "Instructions" + SQL-WIDTH 100 + HELP "Please enter Instructions" + ORDER 130 + +ADD FIELD "PO" OF "Order" AS character + FORMAT "x(20)" + INITIAL "" + LABEL "PO" + SQL-WIDTH 40 + HELP "Please enter the PO." + ORDER 140 + +ADD FIELD "Terms" OF "Order" AS character + DESCRIPTION "This should default to the TERMS specified by the CUSTOMER record." + FORMAT "x(20)" + INITIAL "Net30" + LABEL "Terms" + SQL-WIDTH 40 + HELP "Please enter the terms." + ORDER 150 + +ADD FIELD "SalesRep" OF "Order" AS character + FORMAT "x(4)" + INITIAL "" + LABEL "Sales Rep" + SQL-WIDTH 8 + HELP "Please enter the Sales Rep." + ORDER 160 + +ADD FIELD "BillToID" OF "Order" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Bill To ID" + SQL-WIDTH 4 + HELP "Please enter the BillTo ID." + ORDER 170 + +ADD FIELD "ShipToID" OF "Order" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Ship To ID" + SQL-WIDTH 4 + HELP "Please enter the ShipToID." + ORDER 180 + +ADD FIELD "OrderStatus" OF "Order" AS character + FORMAT "x(20)" + INITIAL "Ordered" + LABEL "Order Status" + SQL-WIDTH 40 + VIEW-AS "VIEW-AS COMBO-BOX + LIST-ITEMS ""Ordered"",""Back Ordered"", ""Partially Shipped"", ""Shipped"" + + + " + HELP "Please enter the Order Status." + ORDER 190 + +ADD FIELD "WarehouseNum" OF "Order" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Warehouse Num" + SQL-WIDTH 4 + VALEXP "(warehousenum = 0) or can-find(warehouse of order)" + VALMSG "Entrer a number greater than zero" + HELP "Please enter the Warehouse Number." + ORDER 200 + +ADD FIELD "Creditcard" OF "Order" AS character + FORMAT "x(20)" + INITIAL "Visa" + LABEL "Credit Card" + SQL-WIDTH 40 + VIEW-AS "VIEW-AS COMBO-BOX + LIST-ITEMS ""Visa"",""American Express"", ""Master Card"" + " + HELP "Please enter the credit card." + ORDER 210 + +ADD INDEX "OrderNum" ON "Order" + UNIQUE + PRIMARY + INDEX-FIELD "Ordernum" ASCENDING + +ADD INDEX "CustOrder" ON "Order" + UNIQUE + INDEX-FIELD "CustNum" ASCENDING + INDEX-FIELD "Ordernum" ASCENDING + +ADD INDEX "OrderDate" ON "Order" + INDEX-FIELD "OrderDate" ASCENDING + +ADD INDEX "OrderStatus" ON "Order" + INDEX-FIELD "OrderStatus" ASCENDING + +ADD INDEX "SalesRep" ON "Order" + INDEX-FIELD "SalesRep" ASCENDING + +ADD TABLE "Invoice" + DESCRIPTION "The invoice table contains transactions for the receivable module." + DUMP-NAME "invoice" + +ADD FIELD "Invoicenum" OF "Invoice" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Invoice Num" + SQL-WIDTH 4 + VALEXP "invoicenum > 0" + VALMSG "Invoice number cannot be zero" + HELP "Please enter an Invoice Number" + ORDER 10 + +ADD FIELD "CustNum" OF "Invoice" AS integer + FORMAT ">>>>9" + INITIAL "0" + LABEL "Cust Num" + SQL-WIDTH 4 + VALEXP "CAN-FIND(customer OF invoice)" + VALMSG "The Customer number entered must be a valid one." + HELP "Please enter a customer number." + ORDER 20 + +ADD FIELD "InvoiceDate" OF "Invoice" AS date + FORMAT "99/99/9999" + INITIAL ? + LABEL "Invoice Date" + SQL-WIDTH 4 + HELP "Please enter an invoice date" + ORDER 30 + +ADD FIELD "Amount" OF "Invoice" AS decimal + FORMAT "->>,>>9.99" + INITIAL "0" + LABEL "Amount" + SQL-WIDTH 17 + HELP "Please enter total invoice amt including shipping and sales." + DECIMALS 2 + ORDER 40 + +ADD FIELD "TotalPaid" OF "Invoice" AS decimal + FORMAT "->>,>>9.99" + INITIAL "0" + LABEL "Total Paid" + SQL-WIDTH 17 + HELP "Please enter Total Paid." + DECIMALS 2 + ORDER 50 + +ADD FIELD "Adjustment" OF "Invoice" AS decimal + FORMAT "->>,>>9.99" + INITIAL "0" + LABEL "Adjustment" + SQL-WIDTH 17 + HELP "Please enter adjustment." + DECIMALS 2 + ORDER 60 + +ADD FIELD "OrderNum" OF "Invoice" AS integer + FORMAT "zzzzzzzzz9" + INITIAL "0" + LABEL "Order Num" + SQL-WIDTH 4 + VALMSG "The Order number entered must be a valid one." + HELP "Please enter an order number." + ORDER 80 + +ADD FIELD "ShipCharge" OF "Invoice" AS decimal + FORMAT "->>,>>9.99" + INITIAL "0" + LABEL "Ship Charge" + SQL-WIDTH 17 + HELP "Please enter a Ship Charge." + DECIMALS 2 + ORDER 120 + +ADD INDEX "InvoiceNum" ON "Invoice" + UNIQUE + PRIMARY + INDEX-FIELD "Invoicenum" ASCENDING + +ADD INDEX "CustNum" ON "Invoice" + INDEX-FIELD "CustNum" ASCENDING + +ADD INDEX "InvoiceDate" ON "Invoice" + INDEX-FIELD "InvoiceDate" ASCENDING + +ADD INDEX "OrderNum" ON "Invoice" + INDEX-FIELD "OrderNum" ASCENDING + +. +PSC +cpstream=ISO8859-1 +. +0000013059 Modified: trunk/prolint/regrtest/findstate.i =================================================================== --- trunk/prolint/regrtest/findstate.i 2006-07-17 21:54:09 UTC (rev 269) +++ trunk/prolint/regrtest/findstate.i 2006-08-04 23:03:53 UTC (rev 270) @@ -3,4 +3,21 @@ FIND FIRST order NO-LOCK. FIND customer OF order NO-LOCK. /* this should NOT raise a warning */ - \ No newline at end of file +/* a couple of variations using NOT : */ + +/* Table testtable1, unique index on field1 field2 field3 */ +DEFINE VARIABLE v AS LOGICAL NO-UNDO. +find testtable1 no-lock + where testtable1.field1 = 0 + and testtable1.field2 = (NOT V) + and testtable1.field3 = "xxx":U + no-error + . + +/* Table testtable1, unique index on field1 field2 field3 */ +find testtable1 no-lock + where testtable1.field1 = 0 + and NOT testtable1.field2 = V + and testtable1.field3 = "xxx":U + no-error + . \ No newline at end of file Modified: trunk/prolint/test.p =================================================================== --- trunk/prolint/test.p 2006-07-17 21:54:09 UTC (rev 269) +++ trunk/prolint/test.p 2006-08-04 23:03:53 UTC (rev 270) @@ -1,15 +1,70 @@ -/* purpose: regression test for prolint itself. - if you changed or added something to prolint, run prolint/test.p - to see if it still finds the same warnings */ +/* ========================================================================================== + file : prolint/test.p + purpose : regression test for prolint itself. + if you changed or added something to prolint, run prolint/test.p + to see if it still finds the same warnings + Copyright (C) 2001-2006 Jurjen Dijkstra + + This file is part of Prolint. + + Prolint is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + Prolint is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with Prolint; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ========================================================================================== */ + + /* how it works: well pretty simple actually... program "prolint/regrtest/test.p" contains a lot of bad programming. profile "regression test" writes logfile "lint-selftest.log" and when it is done, it compares this new log to the already existing "prolint/regrtest/expect.log". if "no differences encountered", prolint is working as expected */ - -RUN prolint/prolint.p ("prolint/regrtest":U, - ?, - "regression test":U, - TRUE). + +IF CONNECTED("sports":U) OR CONNECTED("sports2000":U) THEN DO: + MESSAGE "Please Disconnect The SPORTS Database":T SKIP(1) + "The Prolint regression test requires its own database,":T SKIP + "which cannot be connected alongside SPORTS":T + VIEW-AS ALERT-BOX. + RETURN. +END. + +IF NOT CONNECTED("prolintest":U) THEN DO: + FILE-INFO:FILE-NAME = "prolint/regrtest/db/prolintest.db":U. + IF FILE-INFO:FULL-PATHNAME <> ? THEN DO: + CONNECT VALUE(FILE-INFO:FULL-PATHNAME) -1 NO-ERROR. + IF NOT CONNECTED("prolintest":U) THEN + MESSAGE "Test Database Could Not Be Connected":T SKIP(1) + ERROR-STATUS:GET-MESSAGE(1) + VIEW-AS ALERT-BOX. + END. + ELSE + MESSAGE "Test Database Not Found":T SKIP(1) + "Please create and connect database prolint/regrtest/db/prolintest.db":T SKIP + "with the DF file found in prolint/regrtest/db":T SKIP + "and then try the regression test again":T + VIEW-AS ALERT-BOX. + +END. + +IF CONNECTED("prolintest":U) THEN + RUN prolint/prolint.p ("prolint/regrtest":U, + ?, + "regression test":U, + TRUE). + + +IF CONNECTED("prolintest":U) THEN + DISCONNECT "prolintest":U. + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |