Commit Graph

42 Commits

Author SHA1 Message Date
Neil Brown
3604ab6412 Added some testcases related to checking the use of abbreviations 2009-02-08 23:25:30 +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
8405c646e3 Added a file for testcases for checks that use the new framework 2008-11-10 13:08:14 +00:00
Adam Sampson
3eeda5d821 Add a unit tests file for SimplifyTypes.
The tests in there at the moment are pretty trivial, but I'm going to
want to add more stuff to SimplifyTypes later.
2008-06-11 15:56:24 +00:00
Adam Sampson
f2352019ab Implement INITIAL and RESULT abbreviations.
This adds the passes to transform INITIAL into the correct form.

Fixes #42.
2008-06-03 14:57:24 +00:00
Adam Sampson
6ee21f76c9 Initial work on supporting INITIAL and RESULT abbreviations.
This fixes the AST, parser and typechecker, and adds a pass to
transform Result back into Abbrev, but doesn't transform Initial yet.
(It actually works for trivial stuff anyway, but it won't do the right
thing for complex types or PROC parameters.)

It appears (to me) to make sense to support INITIAL/RESULT reshaping
and retyping too, so this does.

Refs #42.
2008-06-02 20:41:37 +00:00
Neil Brown
3249381995 Added a Rain test file for the type checker 2008-05-17 13:17:12 +00:00
Adam Sampson
17702401fa Rewrite AnalyseAsm's parser.
It now just uses "words" and regular pattern matches rather than regular
expressions. The resulting code is quite a bit simpler, and goes much faster.

I've added some unit tests for it too.
2008-04-05 22:05:17 +00:00
Adam Sampson
6ab4a9923f Implement expression typechecking for occam.
There's obviously some overlap with the Rain typechecker here. I've tried to
cover everything in the AST that could potentially be bound into occam at some
point in the future, even if the occam parser doesn't support it yet (so
this'll do checks for Concat and mobile allocation, for example).
2008-03-22 01:00:42 +00:00
Adam Sampson
3005dfb506 Add a pass for folding constants in occam.
The existing constant-folding code in the parser is still there, since it needs
to know whether things are constant, and A.Dimension expects an Int.

However, this pass is useful because it does a better job of constant folding
than the parser would on its own: it can fold subexpressions of expressions
that are as a whole not constant.
2008-03-17 15:48:43 +00:00
Adam Sampson
26c9e5b57f Tidy up "tocktest --help" to match "tock --help". 2008-03-13 10:55:49 +00:00
Adam Sampson
6df110dce4 Wrap QuickCheck tests into HUnit tests.
This means all the tests now get run as part of one list, and HUnit keeps track
of the number of failures for us. (The reason I was doing this was so that
tocktest will exit non-zero on QuickCheck test failure too.)

As part of this, I've reworked TestMain's main function quite a bit. It'll now
filter QuickCheck tests into response to options too.
2008-03-12 19:38:02 +00:00
Adam Sampson
f71998f8ec Exit non-zero if any of the HUnit tests fail. 2008-03-12 18:06:36 +00:00
Adam Sampson
0c1bf64302 Fix Haddock for TestMain. 2008-03-12 17:32:19 +00:00
Neil Brown
6a784bffd9 Switch the tests for declareSizesArray to be QuickCheck tests rather than HUnit tests 2008-03-05 16:35:37 +00:00
Adam Sampson
d7fbd93816 Add some tests for structureOccam. 2008-02-29 14:08:57 +00:00
Neil Brown
cb8327451d Added the ability to apply a filter to which HUnit tests you run 2008-02-28 16:08:36 +00:00
Adam Sampson
8f2575819b Initial implementation of the occam-pi preprocessor.
This implements #DEFINE, #UNDEF, #IF, #ELSE and #ENDIF, macro expansion with
##, and TRUE, FALSE, AND, OR, NOT and DEFINED within #IF expressions, with the
same semantics as occ21.

The macro COMPILER.TOCK is always defined by default, so you can now say things
like "#IF NOT DEFINED (COMPILER.TOCK) ... #ENDIF".
2008-02-28 20:27:30 +00:00
Neil Brown
f4a294e989 Renamed the RainUsageCheckTest module to UsageCheckTest 2008-02-25 10:28:33 +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
4c176a1a0f Fixed a bug so that tocktest now defaults to running a medium level of quickcheck tests 2008-01-23 14:32:13 +00:00
Neil Brown
6f4146a4f3 Altered the name of the exported ArrayUsageCheckTest function to match the new convention 2008-01-23 13:59:38 +00:00
Neil Brown
df4c0ed1e7 Added an option to TestMain to support outputting plain text as test output rather than the normal TT-erase scheme 2008-01-20 14:18:35 +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
423d22fa13 Moved the ArrayUsageCheck tests to their own new file (ArrayUsageCheckTest) 2007-12-16 14:02:45 +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
51d5d50d45 Added the ability to adjust the level of QuickCheck testing from the command-line 2007-12-13 18:51:25 +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
3d38db522f Updated the documentation in TestMain as to which modules the unit tests come from. 2007-11-12 14:34:50 +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
f0c552663b Added the initial implementation of a module (and tests) for generating a control-flow graph from an AST
This implementation needs to be changed; it currently uses Meta as a primary key for nodes, but that isn't valid.
2007-10-27 21:18:55 +00:00
Neil Brown
9fc166d819 Added the first group of tests for the C and C++ code generation backends 2007-10-02 14:49:31 +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
8d95b65f00 Added support for the new AlternativeWait guards to the C backend
This was not as straightforward as the C++ backend.  CIF has no capability for supporting waiting *for* a specified time as an ALT guard; only waiting until (AFTER, in occam) a specified time.  This is further complicated by the fact that when you disable an ALT timer guard in CIF, you have to be able to supply the timeout value that you waited on in the enable sequence.

Therefore, I added a pass that transforms all WaitFor guards into WaitUntil guards, by declaring nonce time variables, getting the time, and adding on the delay that we want to wait for; these actions occur just before the ALT.

This new pass is in the new BackendPasses module, into which I also moved the identifyParProcs pass.  I also wrote tests for my new pass that live in the new BackendPassesTest module.
2007-09-27 11:48:04 +00:00
Neil Brown
01f763373d Rain: added a new pass for folding constants 2007-09-15 09:36:50 +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
Neil Brown
095b547f9e Added Haddock documentation to the TestMain module 2007-08-28 12:43:30 +00:00
Neil Brown
4d16320d26 Added a PassTest file intended for tests of the occam passes, and put in it a test for the functions-to-procs pass 2007-08-20 17:23:20 +00:00
Adam Sampson
c8d5a4ff40 Add licensing information.
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.

(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
2007-08-18 20:42:11 +00:00
Neil Brown
2d7349eb5d Added a new file for Rain passes, and a file for testing them, and altered the main test rig accordingly 2007-08-16 12:19:30 +00:00
Neil Brown
bed325beea Parallel Usage Checker and Test Rearrangement
This patch is a bit large, being as it encompasses two major changes:

1. The addition of the first version of a parallel usage checker.  The usage checker uses the generics library (like
   the other passes) to work out if the parallel usage rules are broken.  It mainly consists of:
     a) a function used to determine which variables are written to/read from in given bits of code, and 
     b) a function that applies a) across the members of any par construct in the file, and checks that
        the expected usage rules hold
   The parallel usage checker is in an early stage, but I think the design is sensible - at least for doing the variable
   and array usage.  The channel usage checker will require some slightly different functionality, and
   I am not considering the abbreviation checker yet.
2. As a consquence of adding a second test file (UsageCheckTest) alongside the first (RainParseTest), I have 
   created a TestMain class that is intended to run all tests for all parts of Tock.  I have also extracted some
   useful helper functions (for creating the expected results of tests) into a file named TestUtil.  I've also
   modified the Makefil accordingly.
   
There are a few other minor changes to RainParse/RainParseTest that are also included in the patch as separating them
would have been tricky.
2007-07-30 22:04:30 +00:00