Commit Graph

335 Commits

Author SHA1 Message Date
Neil Brown
af130291fc Added some tests for replicated indexes in parallel 2008-01-16 12:14:09 +00:00
Neil Brown
bc2ffc59be Corrected the bounds checking so that (size - 1) is used as the maximum index (not size, as before) 2008-01-16 11:52:32 +00:00
Neil Brown
0df68e53e5 Moved addConstant to the top level of ArrayUsageCheck 2008-01-16 11:52:11 +00:00
Neil Brown
0e57c7af55 Removed a piece of dead code from ArrayUsageCheck 2008-01-16 11:51:54 +00:00
Neil Brown
4b0d29d987 Added support for actually bounds-checking the array based on its declared size 2008-01-16 11:47:54 +00:00
Neil Brown
183e68ee59 Corrected the display of variables relating to REM 2008-01-16 11:34:56 +00:00
Neil Brown
a14a866502 Changed the test harness to get some tests inside the IO monad. This allows all the tests to be run, not just until the first failure 2008-01-16 11:15:05 +00:00
Neil Brown
90fb5e2182 Fixed a bug where multiple problems would be deemed safe as long as one didn't have a solution (as opposed to all not having solutions) 2008-01-16 10:52:51 +00:00
Neil Brown
b5606eb7a9 Tidied up the error messages given when the array usage checker finds a problem 2008-01-16 03:37:53 +00:00
Neil Brown
1c0434cc47 Corrected a small omission in the cases for testing array indices (if there are no problems to work with) 2008-01-16 03:29:13 +00:00
Neil Brown
b3216c4870 Added a test-source-file for testing the array usage checker, and added it to the appropriate test list 2008-01-16 03:28:26 +00:00
Neil Brown
64a9fcf2dd Added the functionality for variable divisors with REM 2008-01-16 01:49:02 +00:00
Neil Brown
bd998a5b95 Added a test for REM with a variable divisor 2008-01-16 01:48:39 +00:00
Neil Brown
612893bd0c Corrected a bug from using zip where an "actual" list of size N would only match the first N elements of the expected, even if expected had more than N items 2008-01-16 00:39:05 +00:00
Neil Brown
f7503ac58c Added a further test involving two REM operations (both still with constant divisors) 2008-01-15 21:22:46 +00:00
Neil Brown
43d0098f99 Added another test for formulating a problem involving the REM operator 2008-01-15 19:14:34 +00:00
Neil Brown
a00b1ea602 Fixed the existing test for modulo items (it now also passes) 2008-01-15 18:50:22 +00:00
Neil Brown
3e674e3773 Fixed the pairing of indices so that two parts of a modulo triplicate-possibility are never paired with each other, and removed the filtering of all-zero equations (primarily to aid in the testing) 2008-01-15 18:48:00 +00:00
Neil Brown
bc7c5072b8 Fixed the display of equations such as 0 = 0 after test failure 2008-01-15 18:47:28 +00:00
Neil Brown
2cb0610d83 Added custom, much more readable display of problems when the assertEquivalentProblems function fails 2008-01-15 18:12:04 +00:00
Neil Brown
d3fca1d610 Moved showMaybe to the Utils module and added a similar showListCustom function 2008-01-15 18:08:56 +00:00
Neil Brown
05e2678cf6 Corrected a bug in the comparison function for FlattenedExp 2008-01-15 17:44:35 +00:00
Neil Brown
f6ba7be173 Changed various uses of the maximum function to make sure they always succeed 2008-01-15 17:33:19 +00:00
Neil Brown
918b9e7af7 Changed the array usage checking and all the tests to support modulo and division
This patch is unavoidably large (no easy way to split it down).  The code compiles, but the modulo test (which is currently wrong anyway) fails at the moment
2008-01-15 17:08:15 +00:00
Neil Brown
421cff1017 Removed the useless (and wrong) scaling aspect of makeEquations 2008-01-12 11:59:55 +00:00
Neil Brown
97fc225bf3 Added some more comments to the Omega Test code 2008-01-09 17:24:56 +00:00
Neil Brown
26bd792e61 Fixed a bug where the non-pruned version of the inequalities were being used in fmElimination; the Omega Test now functions properly 2008-01-09 17:14:15 +00:00
Neil Brown
524275cd9f Added the ability to print out the variable mapping and inequalities in a more readable format when tests fail 2008-01-09 17:14:02 +00:00
Neil Brown
d5a9829b0f Fixed the brute-force problems function so that it properly uses all inequalities not just the left-overs 2008-01-09 14:56:26 +00:00
Neil Brown
4ef97ed8b4 Changed the solveAndPrune test function to always have a valid mapping, even if there are no equalities 2008-01-09 14:55:59 +00:00
Neil Brown
4ee25b62ca Added some more comments to the fmElimination function 2008-01-09 12:46:50 +00:00
Neil Brown
8ec4832a03 Removed the unused half of VariableMapping 2008-01-09 12:27:02 +00:00
Neil Brown
57f18e5b18 Finished implementing the Omega Test - but a few tests are failing and I cannot yet see why 2008-01-09 12:05:09 +00:00
Neil Brown
d23baf719b Added support for multiplication to the usage checking 2007-12-17 11:56:51 +00:00
Neil Brown
337d339641 Added comments to the makeEquations function 2007-12-17 11:43:18 +00:00
Neil Brown
218a1bd22c Rearranged the tests for makeEquations to use a helper function, and added a couple of cases (one of which doesn't yet pass) 2007-12-17 02:38:05 +00:00
Neil Brown
8f1d1368af Stopped makeEquations unnecessarily producing duplicate equations 2007-12-17 02:22:09 +00:00
Neil Brown
5a721fb428 Fixed the processing of expressions to equations to properly square the equations 2007-12-17 02:13:40 +00:00
Neil Brown
dc76d00085 Added better helper functions for testing the processing of expressions into equations 2007-12-17 02:13:17 +00:00
Neil Brown
1733869afd Tidied up the tests and amended SolveEq to allow you to provide the answers, which are then checked 2007-12-16 19:20:53 +00:00
Neil Brown
02aa63ffda Fixed the QuickCheck equality-equation generater so that it can no longer produce unsolveable equations 2007-12-16 19:05:32 +00:00
Neil Brown
70ce98021a Added a few more HUnit tests for the equality solver 2007-12-16 19:05:01 +00:00
Neil Brown
3965babaff Tidied up the testing framework for the HUnit Omega Test tests 2007-12-16 15:27:07 +00:00
Neil Brown
7403588aea Fixed a situation where QuickCheck could occasionally generate duplicate equalities (where one was the negation of the other) 2007-12-16 14:12:29 +00:00
Neil Brown
423d22fa13 Moved the ArrayUsageCheck tests to their own new file (ArrayUsageCheckTest) 2007-12-16 14:02:45 +00:00
Neil Brown
4f88a1e4a1 Added negative coefficients to the QuickCheck tests 2007-12-16 13:43:45 +00:00
Neil Brown
a0203ff971 Corrected a haddock comment 2007-12-16 13:38:23 +00:00
Neil Brown
6320bfdffb Tidied up some of the QuickCheck tests for the Omega Test pruning 2007-12-16 13:35:51 +00:00
Neil Brown
cc7d32ffeb Corrected a mistake in a comment 2007-12-16 12:51:41 +00:00
Neil Brown
3a65651885 Added a really hacky initial implementation of a pass that checks that parallel array usage is safe 2007-12-16 02:07:02 +00:00
Neil Brown
b4ccc9f8de Changed the representation of the exact (constant) solutions to equations to be a simple Map 2007-12-16 00:55:38 +00:00
Neil Brown
a1d3501313 Changed the QuickCheck tests to test that we can get the exact answer from a full equality set, and rather ham-fistedly fixed a bug where substitutions were being applied multiple times to the variable mapping 2007-12-16 00:33:27 +00:00
Neil Brown
d5461bb10b Moved the norm helper to be a top-level function in the tests 2007-12-15 03:19:25 +00:00
Neil Brown
3e4e5355ff Changed the VariableMapping mess into a more correct mess 2007-12-15 02:58:08 +00:00
Neil Brown
c0d06ce173 Added a first attempt at recording the variable mappings during equation manipulation, and changed all the current tests to ignore it 2007-12-15 00:34:50 +00:00
Neil Brown
2df97f813f Removed some unused old code from the ArrayUsageCheck module 2007-12-14 23:22:25 +00:00
Neil Brown
74490c005e Added some (fairly messy) code for taking a list of A.Expression and generating a list of equations 2007-12-14 23:15:39 +00:00
Neil Brown
d674a2fdd0 Added inequality elimination to the Omega Test, but need to also add the code for checking for integer solutions 2007-12-14 16:48:13 +00:00
Neil Brown
9d562c0b12 Corrected checkConstantEq to actually remove the constant equations, rather than only checking them for consistency 2007-12-14 16:45:34 +00:00
Neil Brown
d9b606143e Fixed a Haddock comment 2007-12-14 15:27:51 +00:00
Neil Brown
3814a039d5 Refactored the use of mygcd with foldl into one function 2007-12-14 15:17:19 +00:00
Neil Brown
1dabdfef9d Added some tests for the Omega Test that are not "easily" solved 2007-12-14 12:25:29 +00:00
Neil Brown
97c670b2ff Fixed and documented the checkOpposite function so that it works properly and the tests pass 2007-12-14 04:13:01 +00:00
Neil Brown
3380596ef0 Added more tests for the usage checker, and a helper function for testing parallel items 2007-12-14 04:12:29 +00:00
Neil Brown
2050124658 Added tests for solving equalities and inequalities, and an easy way of writing those tests using user-defined operators 2007-12-14 02:41:15 +00:00
Neil Brown
57311d8d1e Added consistency checking for constant-only inequalities and also added a few more useful functions 2007-12-14 01:11:29 +00:00
Neil Brown
22b09ad95c Changed the tests to also test pruning inconsistent equations 2007-12-14 00:41:06 +00:00
Neil Brown
c7fe0f1515 Added equation pruning and tested most of it using QuickCheck 2007-12-14 00:02:15 +00:00
Neil Brown
26dd2fa5c4 Renamed the TestUtil and TreeUtil modules to TestUtils and TreeUtils, to be consistent with the Utils module 2007-12-13 19:05:29 +00:00
Neil Brown
337f189b8a Separated the QuickCheck tests from the HUnit tests and made the number of test-cases configurable for the QuickCheck tests 2007-12-13 18:21:53 +00:00
Neil Brown
cbeb3ecd95 Added a QuickCheck test for the equality-solving part of the Omega test 2007-12-13 15:33:14 +00:00
Neil Brown
b1a8f1d30d Made the arrayise function act on one list at a time, and made it visible for other functions 2007-12-13 15:32:46 +00:00
Neil Brown
e56d02b727 Made the mygcd function visible so that I can use it in building tests 2007-12-13 15:32:04 +00:00
Neil Brown
9082e5c887 Added lots of comments to the solveConstraints function and made a few trivial tweaks 2007-12-12 18:04:46 +00:00
Neil Brown
8d2751439b Added another call to normaliseEq inside solveNext 2007-12-12 18:03:18 +00:00
Neil Brown
4e58d48d1c Renamed normalise to normaliseEq and stopped it being applied to inequalities (as it will fail needlessly on those!) 2007-12-12 18:02:19 +00:00
Neil Brown
4eae0ede18 Removed the changeAllButOneDifferent function and replaced it with simpler code 2007-12-12 17:48:30 +00:00
Neil Brown
88f7d1ec92 Refactored the equation normalisation and added a custom GCD function 2007-12-12 17:40:37 +00:00
Neil Brown
94dca6fc10 Fixed a bug in the solveUnits function where everything was always being negated, when it should be dependent on whether the unit coefficient was 1 or -1 2007-12-12 17:24:50 +00:00
Neil Brown
76dc1c3b53 Added another test for the Omega Test 2007-12-12 17:21:25 +00:00
Neil Brown
bea8606bdc Added more tests for the Omega Test equality solver, including one that highlights a current bug 2007-12-12 15:07:39 +00:00
Neil Brown
a5e277505f Rewrote the substIn function in solveConstraints to be clearer and simpler 2007-12-12 15:07:01 +00:00
Neil Brown
1aa914e077 Tidied up the checkForUnit function in solveConstraints 2007-12-12 14:25:24 +00:00
Neil Brown
52054dff9f Simplified the type of solve in solveConstraints (it doesn't actually need to return a value) and added a comment 2007-12-12 14:20:17 +00:00
Neil Brown
cba5ff45f1 Fixed a small bug in the equation normalisation 2007-12-12 14:16:29 +00:00
Neil Brown
2354c6a933 Simplified some monadic code in solveConstraints 2007-12-12 14:08:09 +00:00
Neil Brown
83ee41c75c Transformed uses of the StIneq type into their long version so that I can remove StIneq (was only used in a few places anyway) 2007-12-12 14:03:07 +00:00
Neil Brown
961e1837de Removed a couple of unused lines from the Omega Test 2007-12-12 13:58:52 +00:00
Neil Brown
c46580fbda Changed the monad in the Omega Test equality stuff to StateT Maybe rather than State, and fixed some bugs in the Omega Test 2007-12-12 13:57:44 +00:00
Neil Brown
e34ebc67ea Fixed a warning about the type of 0.5 defaulting to Double 2007-12-12 13:56:33 +00:00
Neil Brown
4a83bd8b41 Added another test, from the Omega Test paper 2007-12-12 13:54:04 +00:00
Neil Brown
6598ebd3c8 Added a helper function for the Omega Test tests, and added a further test 2007-12-11 17:21:30 +00:00
Neil Brown
ed43b750c1 Added an initial messy implementation of the equality part of the Omega test 2007-12-11 16:54:36 +00:00
Neil Brown
7fe77146d0 Added some more documentation in the PassTest module. 2007-11-12 18:03:25 +00:00
Neil Brown
8f96af8bb8 Changed a few functions to use the new helper function foldFuncs 2007-11-09 01:21:30 +00:00
Neil Brown
bacc3115e9 Added various general helper functions to the Utils module 2007-11-09 01:18:42 +00:00
Neil Brown
78b3c038c3 Changed the types in RainUsageCheck and RainUsageCheckTest to match the changes to FlowGraph's type 2007-11-07 13:45:43 +00:00
Neil Brown
3b43411d4e Changed the type of findReachDef, implemented it, and wrote some basic tests for it (that pass) 2007-11-02 23:47:20 +00:00
Neil Brown
341e324415 Added an export list to the RainUsageCheck module 2007-11-02 16:46:42 +00:00
Neil Brown
093447dd24 Added a skeleton function for findReachDef, along with the start of some tests for it 2007-11-02 16:46:20 +00:00
Neil Brown
5f57803616 Moved assertEither and assertEitherFail into TestUtil 2007-11-02 16:44:10 +00:00
Neil Brown
4bb2b2a407 Moved mapPair into Utils, and renamed it to transformPair (to be consistent with the pre-existing transformX functions) 2007-11-02 16:44:02 +00:00
Neil Brown
153a1823a7 Changed the tests for checkInitVar so that they display the new error return upon failure 2007-11-02 11:45:22 +00:00
Neil Brown
8472f991d0 Added error return to the checkInitVar function, and also changed it to use the new extended Set implementation, which in turn allowed me to fix the bug in the checkInitVar function (defVal is Everything, not the empty set) 2007-11-02 11:44:04 +00:00
Neil Brown
7d89b4aec0 Added the implementation of an ExSet type that can easily represent the set of everything 2007-11-02 11:41:59 +00:00
Neil Brown
c43a11c057 Added more checkInitVar tests (for sequential loops), but some of them fail 2007-11-01 16:39:03 +00:00
Neil Brown
6fbca55569 Added comments to the tests for checkInitVar, and added a couple more tests 2007-11-01 16:24:47 +00:00
Neil Brown
cf0cc81ae4 Added a new function that checks that variables are initialised before they are read in a control-flow graph, and added tests for it (that all now pass) 2007-11-01 11:45:36 +00:00
Neil Brown
75ed35f2e3 Fixed a list of imports not being in alphabetical order in RainUsageCheckTest 2007-11-01 11:44:38 +00:00
Neil Brown
49de728d6f Added code relating to declarations in the flow-graph labels for usage checking 2007-11-01 00:33:44 +00:00
Neil Brown
fddc3fb6b8 Added support for simple input statements to the usage checker 2007-10-29 18:42:33 +00:00
Neil Brown
5280bb4fc6 Added support for output statements to the usage checker 2007-10-29 18:29:29 +00:00
Neil Brown
1f97bc7d49 Merged some common code in the usage checker (for processing the Variables) 2007-10-29 18:23:46 +00:00
Neil Brown
cb964c620f Added support for the time statements in the usage checker 2007-10-29 17:57:57 +00:00
Neil Brown
a891e34d24 Tidied up some of the usage checker tests 2007-10-29 17:53:58 +00:00
Neil Brown
1d785b3c6d Changed the usage checker tests to match the new usage checker 2007-10-29 17:32:34 +00:00
Neil Brown
d38c2aef08 Overhauled the usage checker to use sets of Strings for recording the used variables 2007-10-29 17:32:23 +00:00
Neil Brown
700ddf149e Moved the old attempt at a usage checker into a new module just for doing Rain usage checks 2007-10-29 17:13:23 +00:00
Neil Brown
6b95827cab Added an optional initialiser-expression to Declaration in the AST, and changed the rest of the code accordingly 2007-10-24 23:50:00 +00:00
Neil Brown
cd313fbbb6 Added a comment about DerefVariable in SimplifyExprs 2007-10-24 16:00:47 +00:00
Neil Brown
acca3d03fd Removed the A.Main item from the AST entirely 2007-10-17 13:43:40 +00:00
Neil Brown
3727307a78 Changed the shared passes to operate on Structured items, rather than Process items 2007-10-17 13:24:42 +00:00
Neil Brown
a25824b601 Changed the passes to be of type Pass, rather than A.Process -> PassM A.Process 2007-10-17 13:09:16 +00:00
Neil Brown
e9dbfbab3c Added the input-case to case pass to the pass-list, and therefore removed all code dealing with input-case statements in the C and C++ backends (and corresponding tests) 2007-10-14 00:01:44 +00:00
Neil Brown
d98cb21415 Added support for transforming ALT guards to the input-case -> case pass 2007-10-13 23:56:36 +00:00
Neil Brown
8b2e14f3bd Added tests and implementation for a new pass for transforming input-case statements into case statements 2007-10-13 23:28:41 +00:00
Neil Brown
443b648d73 Corrected the pass that creates abbreviations for output expressions to also work on OutputCase statements 2007-10-13 20:52:42 +00:00
Neil Brown
126226b039 Implemented the outExprs pass, and got it passing all the tests 2007-10-11 00:12:41 +00:00
Neil Brown
73ee9319e1 Added more tests for the outExprs pass in PassTest 2007-10-11 00:12:08 +00:00
Neil Brown
c7fe2431db Added a test for the new outExprs pass 2007-10-10 23:46:58 +00:00
Neil Brown
d04adba875 Added a new SimplifyComms module, containing a new (currently dummy) pass, outExprs 2007-10-10 23:13:01 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
a5c2dedb24 Changed the testPass* functions in TestUtil to return Assertion instead of Test 2007-09-15 13:35:51 +00:00
Neil Brown
000270f4a8 Created a new module for tests in the common directory (named CommonTest) and moved testIsSafeConversion across 2007-09-11 23:34:45 +00:00
Neil Brown
2ff46a9041 Rearranged the Rain source files, renamed a couple of Rain files, and changed the Makefile accordingly. 2007-09-10 17:28:57 +00:00