Commit Graph

49 Commits

Author SHA1 Message Date
Adam Sampson
77be0c1137 Add some testcases for usage-checking on user-defined array types.
These were based on KRoC bug #194, submitted by Jonathan May.
2009-03-21 15:37:56 +00:00
Neil Brown
b4e79ca62e Realised that channels are not being parallel usage checked at all, and added testcases for them 2009-02-09 10:28:45 +00:00
Neil Brown
00a8be1984 Added some tests ready to check usage checking on channel arrays 2009-02-08 23:40:40 +00:00
Neil Brown
9c4b8e8df1 Changed tocktest so you can pass it -v options for use with the automatic tests 2009-02-08 16:33:53 +00:00
Neil Brown
2ecd91e36f Changed the array usage checking to always include equations involving replicators
This allows us to check situations like this:

PAR i = 0 FOR 10
  IF
    i = 0
      a[10] := 3
    TRUE
      a[i] := 3

Previously this would have been flagged unsafe (because 10 can overlap with 10 between the replicated branches).

But with this change, the equations on the replicators (including: i'>=i+1, i = 0, i' = 0) are included alongside 10=10, so there is no solution over all because the replicator equations prevent a solution (i.e. the 10 can't be used twice in parallel).
2009-02-05 15:47:41 +00:00
Neil Brown
6f607972e6 Added some more usage check tests, primarily for non-array variables used in odd ways in replicated PARs 2009-02-04 09:37:28 +00:00
Neil Brown
594d7ef242 Tweaked various code in the common and checks directory to work with the new step count in the For replicator 2009-01-28 23:43:16 +00:00
Neil Brown
949c88bb75 Added support for the canonicalisation of simple Expressions
This seems to have fixed a couple more normal tests, and goes towards fixing the randomly failing quickcheck test (but that test is not fixed, yet)
2009-01-18 00:20:14 +00:00
Neil Brown
e20671e44f Fixed a couple more array usage tests 2009-01-15 19:37:37 +00:00
Neil Brown
155714abcb Changed the ArrayUsageCheckTest module to supply background knowledge about the replicators to the equation generation 2009-01-15 18:38:13 +00:00
Neil Brown
b9b025a429 Added some tests for the new usage checking and reachability mechanisms 2008-06-05 23:11:00 +00:00
Neil Brown
c9da4a7eaf Overhauled the way that the array usage checking deals with background knowledge, ready to implement usage checking that makes proper use of background knowledge (information from elsewhere in the program) 2008-06-05 20:37:59 +00:00
Neil Brown
41ff60cb78 Removed the Rep constructor from Structured and instead added a Rep constructor to SpecType
This way, all replicators are declared like other names, and their scope is considered replicated.  This simplifies the code a little.

Fixes #55
2008-06-04 17:00:43 +00:00
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Neil Brown
7d65db43c0 Changed TestHarness to support Rain test files as well as occam 2008-05-17 13:13:52 +00:00
Neil Brown
ecb82d13a8 Revamped the ShowCode module, transforming it to use the writer monad 2008-03-20 16:20:14 +00:00
Neil Brown
03eab6c142 Fixed some typing relating to QuickCheck and the TestMonad to avoid type ambiguities in future 2008-03-05 16:04:30 +00:00
Neil Brown
1960deef39 Noted down a QuickCheck failure in ArrayUsageCheckTest 2008-02-25 12:09:21 +00:00
Neil Brown
74f3cb7fc2 Removed the export of "m" in TestUtils, instead moving the definition to each module that uses it (less confusing that way) 2008-02-24 18:55:44 +00:00
Neil Brown
2ea7e15570 Changed the QuickCheck tests to test multiplied variables more thoroughly 2008-02-11 14:26:55 +00:00
Neil Brown
fdb2e8d45d Printed out more information when generateMapping fails (keys to VarMap not matching) 2008-02-11 12:02:20 +00:00
Neil Brown
04be245677 Adjusted the printing out of FlattenedExp; useful on test failure 2008-02-11 11:31:20 +00:00
Neil Brown
f403a90ccf Adjusted the ArrayUsageCheckTest QuickCheck tests to allow expressions in the top and bottom of modulo, and the top of divides 2008-02-11 11:03:32 +00:00
Neil Brown
b83acaf7c5 Corrected a few comments in ArrayUsageCheckTest 2008-02-11 10:17:27 +00:00
Neil Brown
18cf66944a Modified the array usage checking to treat any unknown expressions (function calls, etc) like variables were treated before 2008-02-10 23:58:32 +00:00
Neil Brown
94d9fedd0e Tweaked some of the probabilities in the ArrayUsageCheckTest QuickCheck tests 2008-02-10 21:20:30 +00:00
Neil Brown
16279f4d1d Added tests for the Divide item to the QuickCheck tests in ArrayUsageCheckTest 2008-02-09 20:12:30 +00:00
Neil Brown
41ab2d6bde Introduced scaling of Modulo and Divide items, and tweaked some of the parameters to make the tests a little shorter 2008-02-09 17:23:49 +00:00
Neil Brown
25be01cb47 Added a coefficient for modulo and divide items 2008-02-09 15:08:10 +00:00
Neil Brown
c6b384d5d6 A large change, introducing tags for modulo items during array usage checking so that they can be accurately tested 2008-02-09 14:52:07 +00:00
Neil Brown
d0b94e402c Added (constant divisor, for now) modulo to the QuickCheck tests in ArrayUsageCheckTest 2008-02-09 11:36:37 +00:00
Neil Brown
7fbb83a813 Fiddled with the types of genNewItem and similar functions, ready to support compound expressions in the QuickCheck tests 2008-02-09 02:01:01 +00:00
Neil Brown
cbd4a98ad5 Improved the error message when an array usage check test fails 2008-02-09 01:55:07 +00:00
Neil Brown
842b6b7788 Simplified the QuickCheck test in ArrayUsageCheckTest 2008-02-09 00:57:01 +00:00
Neil Brown
618ac31ae2 Added a QuickCheck test for makeEquations 2008-02-09 00:20:20 +00:00
Neil Brown
2343110311 Refactored some of ArrayUsageCheckTest, simplified it a little and corrected a bug in the test framework
Previously, the assertEquivalentProblems function and functions used by it dealt with results inside Maybe, sometimes then inside IO.  These functions have been migrated to the new TestMonad.  Instead of using Maybe, any problems with the test are dealt with by failing the test instead.

The assertEquivalentProblems function used to take a list of labelled expressions for comparison purposes.  Now that we have an ordering on the AST, this is pointless.  Instead we can directly sort the lists by the expressions involved.  This simplifies the code a little.

Finally, a bug has been fixed.  The mapping between expected and actual columns in the swapColumns' function of translateEquations was being used as a backward mapping, even though it was in fact a forward mapping.  So that has also been corrected.
2008-02-08 23:58:28 +00:00
Neil Brown
38002bf9a8 Added another array usage check test 2008-02-08 23:56:59 +00:00
Neil Brown
914e9c3d71 Added a new test framework, based on simple monads, to allow easy unification of HUnit and QuickCheck tests with the minimum of work 2008-02-08 16:56:32 +00:00
Neil Brown
f82b6cf6a7 Finished writing the long test for replicated modulo, which seems to pass 2008-02-07 15:35:39 +00:00
Neil Brown
af0160e4fe Added a test to show up a bug in handling replicator from/for values 2008-02-07 00:23:08 +00:00
Neil Brown
4cb02c4c71 Added lots more checks in ArrayUsageCheckTest that aim to produce a useful message when a usage check is failing 2008-02-06 23:55:25 +00:00
Neil Brown
74d5bc675d Shorted the definition of generateMapping in ArrayUsageCheckTest 2008-02-06 23:55:01 +00:00
Neil Brown
ba04340989 Changed the ArrayUsageCheckTest framework to give you a test failure (rather than an unhelpful Haskell error) when translateEquations fails to result in a valid array 2008-02-06 23:27:59 +00:00
Neil Brown
416e385017 Added labels to all the QuickCheck tests to make it easier to see which one has failed 2008-02-05 22:15:17 +00:00
Neil Brown
1b7e0985cc Added labels to a few tests and began writing a new one for replicated variables and modulo 2008-02-04 08:06:32 +00:00
Neil Brown
41194f757f Added support for background knowledge to makeEquations in ArrayUsageCheck, and fed all the replicator bounds into it 2008-02-03 12:44:51 +00:00
Neil Brown
f26b3309a3 Added a new file of testcases for testing passed parameters 2008-01-29 11:39:04 +00:00
Neil Brown
5ff006f75d Renamed the UsageCheck module to UsageCheckUtils 2008-01-28 12:59:22 +00:00
Neil Brown
efc69a97cf Moved all the modules related to usage-checking into a new checks directory 2008-01-28 12:25:00 +00:00