2020-05-19 20:25:18 +03:00
|
|
|
module Main
|
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
import System
|
|
|
|
import System.Directory
|
|
|
|
import System.File
|
|
|
|
|
2021-03-09 21:27:05 +03:00
|
|
|
import Test.Golden
|
2020-10-19 11:26:23 +03:00
|
|
|
|
2020-05-19 20:25:18 +03:00
|
|
|
%default covering
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Test cases
|
|
|
|
|
2020-10-19 11:26:23 +03:00
|
|
|
ttimpTests : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
ttimpTests = MkTestPool "TTImp" [] Nothing
|
2021-02-05 19:16:20 +03:00
|
|
|
[ "basic001", "basic002", "basic003", "basic004", "basic005"
|
|
|
|
, "basic006"
|
2021-09-07 01:37:59 +03:00
|
|
|
, "coverage002"
|
2021-02-05 19:16:20 +03:00
|
|
|
, "dot001"
|
2021-09-07 01:37:59 +03:00
|
|
|
, "eta001"
|
2021-02-05 19:16:20 +03:00
|
|
|
, "lazy001"
|
|
|
|
, "nest001", "nest002"
|
|
|
|
, "perf001", "perf002", "perf003"
|
2021-09-24 13:23:46 +03:00
|
|
|
, "record001", "record002", "record003", "record004"
|
2021-02-05 19:16:20 +03:00
|
|
|
, "qtt001", "qtt003"
|
|
|
|
, "total001", "total002", "total003"
|
|
|
|
]
|
2020-05-19 20:25:18 +03:00
|
|
|
|
2020-12-08 01:51:33 +03:00
|
|
|
idrisTestsBasic : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsBasic = MkTestPool "Fundamental language features" [] Nothing
|
2020-10-19 11:26:23 +03:00
|
|
|
-- Fundamental language features
|
2020-05-19 20:25:18 +03:00
|
|
|
["basic001", "basic002", "basic003", "basic004", "basic005",
|
|
|
|
"basic006", "basic007", "basic008", "basic009", "basic010",
|
|
|
|
"basic011", "basic012", "basic013", "basic014", "basic015",
|
|
|
|
"basic016", "basic017", "basic018", "basic019", "basic020",
|
|
|
|
"basic021", "basic022", "basic023", "basic024", "basic025",
|
|
|
|
"basic026", "basic027", "basic028", "basic029", "basic030",
|
|
|
|
"basic031", "basic032", "basic033", "basic034", "basic035",
|
|
|
|
"basic036", "basic037", "basic038", "basic039", "basic040",
|
2020-08-27 20:09:39 +03:00
|
|
|
"basic041", "basic042", "basic043", "basic044", "basic045",
|
2021-06-22 00:12:17 +03:00
|
|
|
"basic046", "basic047", "basic049", "basic050",
|
2021-03-16 17:08:50 +03:00
|
|
|
"basic051", "basic052", "basic053", "basic054", "basic055",
|
2021-06-15 12:32:42 +03:00
|
|
|
"basic056", "basic057", "basic058", "basic059", "basic060",
|
2021-11-24 22:12:46 +03:00
|
|
|
"basic061", "basic062", "basic063", "basic064", "basic065",
|
2021-12-12 05:03:36 +03:00
|
|
|
"basic066", "basic067", "basic068",
|
2022-01-24 19:18:36 +03:00
|
|
|
"idiom001",
|
2022-07-07 19:14:00 +03:00
|
|
|
"rewrite001",
|
2021-10-19 01:12:48 +03:00
|
|
|
"interpolation001", "interpolation002", "interpolation003",
|
|
|
|
"interpolation004"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
2022-04-29 14:52:23 +03:00
|
|
|
idrisTestsDebug : TestPool
|
|
|
|
idrisTestsDebug = MkTestPool "Debug features" [] Nothing
|
|
|
|
["debug001"]
|
|
|
|
|
2020-12-08 01:51:33 +03:00
|
|
|
idrisTestsCoverage : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsCoverage = MkTestPool "Coverage checking" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Coverage checking
|
2020-12-08 01:51:33 +03:00
|
|
|
["coverage001", "coverage002", "coverage003", "coverage004",
|
2020-05-24 14:52:07 +03:00
|
|
|
"coverage005", "coverage006", "coverage007", "coverage008",
|
2021-02-23 13:51:38 +03:00
|
|
|
"coverage009", "coverage010", "coverage011", "coverage012",
|
2021-05-17 19:34:56 +03:00
|
|
|
"coverage013", "coverage014", "coverage015", "coverage016",
|
2021-09-09 17:30:30 +03:00
|
|
|
"coverage017", "coverage018", "coverage019"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
2022-09-01 12:47:12 +03:00
|
|
|
idrisTestsTermination : TestPool
|
|
|
|
idrisTestsTermination = MkTestPool "Termination checking" [] Nothing
|
|
|
|
-- Termination checking
|
|
|
|
["termination001"]
|
|
|
|
|
2021-02-26 12:33:07 +03:00
|
|
|
idrisTestsCasetree : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsCasetree = MkTestPool "Case tree building" [] Nothing
|
2021-02-26 12:33:07 +03:00
|
|
|
-- Case tree building
|
2021-10-02 14:55:21 +03:00
|
|
|
["casetree001", "casetree002"]
|
2021-02-26 12:33:07 +03:00
|
|
|
|
2021-05-14 19:35:21 +03:00
|
|
|
idrisTestsWarning : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsWarning = MkTestPool "Warnings" [] Nothing
|
2021-12-16 21:23:18 +03:00
|
|
|
["warning001", "warning002", "warning003"]
|
2021-05-14 19:35:21 +03:00
|
|
|
|
2022-04-07 13:23:05 +03:00
|
|
|
idrisTestsFailing : TestPool
|
|
|
|
idrisTestsFailing = MkTestPool "Failing blocks" [] Nothing
|
2022-04-08 00:57:08 +03:00
|
|
|
["failing001", "failing002", "failing003"
|
2022-04-07 13:23:05 +03:00
|
|
|
]
|
|
|
|
|
2020-12-08 01:51:33 +03:00
|
|
|
idrisTestsError : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsError = MkTestPool "Error messages" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Error messages
|
2020-12-08 01:51:33 +03:00
|
|
|
["error001", "error002", "error003", "error004", "error005",
|
2020-05-19 20:25:18 +03:00
|
|
|
"error006", "error007", "error008", "error009", "error010",
|
2021-02-25 11:51:27 +03:00
|
|
|
"error011", "error012", "error013", "error014", "error015",
|
2021-08-09 12:00:34 +03:00
|
|
|
"error016", "error017", "error018", "error019", "error020",
|
2022-04-07 13:23:05 +03:00
|
|
|
"error021", "error022", "error023",
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Parse errors
|
|
|
|
"perror001", "perror002", "perror003", "perror004", "perror005",
|
2021-08-20 18:47:47 +03:00
|
|
|
"perror006", "perror007", "perror008", "perror009", "perror010",
|
2022-09-02 07:41:04 +03:00
|
|
|
"perror011", "perror012", "perror013", "perror014", "perror015",
|
|
|
|
"perror016"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsInteractive : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsInteractive = MkTestPool "Interactive editing" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Interactive editing support
|
2020-12-08 01:51:33 +03:00
|
|
|
["interactive001", "interactive002", "interactive003", "interactive004",
|
2020-05-19 20:25:18 +03:00
|
|
|
"interactive005", "interactive006", "interactive007", "interactive008",
|
|
|
|
"interactive009", "interactive010", "interactive011", "interactive012",
|
2020-08-04 14:51:57 +03:00
|
|
|
"interactive013", "interactive014", "interactive015", "interactive016",
|
2021-02-05 19:15:40 +03:00
|
|
|
"interactive017", "interactive018", "interactive019", "interactive020",
|
|
|
|
"interactive021", "interactive022", "interactive023", "interactive024",
|
2021-03-17 13:54:25 +03:00
|
|
|
"interactive025", "interactive026", "interactive027", "interactive028",
|
2021-06-08 19:03:06 +03:00
|
|
|
"interactive029", "interactive030", "interactive031", "interactive032",
|
2021-09-19 13:33:48 +03:00
|
|
|
"interactive033", "interactive034", "interactive035", "interactive036",
|
2021-11-25 18:05:46 +03:00
|
|
|
"interactive037", "interactive038", "interactive039", "interactive040",
|
2022-09-02 12:49:19 +03:00
|
|
|
"interactive041", "interactive042", "interactive043", "interactive044"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsInterface : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsInterface = MkTestPool "Interface" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Interfaces
|
2020-12-08 01:51:33 +03:00
|
|
|
["interface001", "interface002", "interface003", "interface004",
|
2020-05-19 20:25:18 +03:00
|
|
|
"interface005", "interface006", "interface007", "interface008",
|
|
|
|
"interface009", "interface010", "interface011", "interface012",
|
2020-06-11 16:28:34 +03:00
|
|
|
"interface013", "interface014", "interface015", "interface016",
|
2020-12-14 16:38:40 +03:00
|
|
|
"interface017", "interface018", "interface019", "interface020",
|
2021-03-09 17:13:29 +03:00
|
|
|
"interface021", "interface022", "interface023", "interface024",
|
2022-04-27 12:26:38 +03:00
|
|
|
"interface025", "interface026", "interface027", "interface028"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsLinear : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsLinear = MkTestPool "Quantities" [] Nothing
|
2020-12-08 01:51:33 +03:00
|
|
|
-- QTT and linearity related
|
|
|
|
["linear001", "linear002", "linear003", -- "linear004" -- disabled due to requiring linearity subtyping
|
|
|
|
"linear005", "linear006", "linear007", "linear008",
|
2021-02-24 14:07:16 +03:00
|
|
|
"linear009", "linear010", "linear011", "linear012",
|
2021-11-25 20:07:05 +03:00
|
|
|
"linear013", "linear014", "linear015"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsLiterate : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsLiterate = MkTestPool "Literate programming" [] Nothing
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Literate
|
|
|
|
["literate001", "literate002", "literate003", "literate004",
|
|
|
|
"literate005", "literate006", "literate007", "literate008",
|
|
|
|
"literate009", "literate010", "literate011", "literate012",
|
2022-02-18 14:29:52 +03:00
|
|
|
"literate013", "literate014", "literate015", "literate016",
|
|
|
|
"literate017"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsPerformance : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsPerformance = MkTestPool "Performance" [] Nothing
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Performance: things which have been slow in the past, or which
|
|
|
|
-- pose interesting challenges for the elaborator
|
2021-06-22 00:12:17 +03:00
|
|
|
["perf001", "perf002", "perf003", "perf004", "perf005",
|
2022-01-11 19:06:19 +03:00
|
|
|
"perf007", "perf008", "perf009", "perf010", "perf011",
|
|
|
|
"perf2202"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
|
|
|
idrisTestsRegression : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsRegression = MkTestPool "Various regressions" [] Nothing
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Miscellaneous regressions
|
|
|
|
["reg001", "reg002", "reg003", "reg004", "reg005", "reg006", "reg007",
|
|
|
|
"reg008", "reg009", "reg010", "reg011", "reg012", "reg013", "reg014",
|
|
|
|
"reg015", "reg016", "reg017", "reg018", "reg019", "reg020", "reg021",
|
|
|
|
"reg022", "reg023", "reg024", "reg025", "reg026", "reg027", "reg028",
|
2021-01-20 22:13:07 +03:00
|
|
|
"reg029", "reg030", "reg031", "reg032", "reg033", "reg034", "reg035",
|
2021-06-23 20:08:27 +03:00
|
|
|
"reg036", "reg037", "reg038", "reg039", "reg040", "reg041", "reg042",
|
2021-09-05 14:37:59 +03:00
|
|
|
"reg043", "reg044", "reg045", "reg046", "reg047", "reg048", "reg049",
|
|
|
|
"reg050"]
|
2020-12-08 01:51:33 +03:00
|
|
|
|
2021-03-31 19:57:31 +03:00
|
|
|
idrisTestsData : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsData = MkTestPool "Data and record types" [] Nothing
|
2021-03-31 19:57:31 +03:00
|
|
|
[-- Data types
|
|
|
|
"data001",
|
|
|
|
-- Records, access and dependent update
|
|
|
|
"record001", "record002", "record003", "record004", "record005",
|
2021-11-19 18:31:18 +03:00
|
|
|
"record006", "record007", "record008", "record009", "record010",
|
2022-06-16 18:32:00 +03:00
|
|
|
"record011", "record012", "record013", "record014", "record015",
|
|
|
|
"record016" ]
|
2021-03-31 19:57:31 +03:00
|
|
|
|
2021-04-22 15:08:32 +03:00
|
|
|
idrisTestsBuiltin : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsBuiltin = MkTestPool "Builtin types and functions" [] Nothing
|
2021-04-22 15:08:32 +03:00
|
|
|
-- %builtin related tests for the frontend (type-checking)
|
2021-05-10 14:14:19 +03:00
|
|
|
["builtin001", "builtin002", "builtin003", "builtin004", "builtin005",
|
2021-05-13 20:44:24 +03:00
|
|
|
"builtin006", "builtin007", "builtin008", "builtin009", "builtin010",
|
|
|
|
"builtin011"]
|
2021-04-22 15:08:32 +03:00
|
|
|
|
2021-04-15 16:08:50 +03:00
|
|
|
idrisTestsEvaluator : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsEvaluator = MkTestPool "Evaluation" [] Nothing
|
2021-04-15 16:08:50 +03:00
|
|
|
[ -- Evaluator
|
2022-05-14 12:46:55 +03:00
|
|
|
"evaluator001", "evaluator002", "evaluator003", "evaluator004",
|
2021-04-15 16:08:50 +03:00
|
|
|
-- Miscellaneous REPL
|
|
|
|
"interpreter001", "interpreter002", "interpreter003", "interpreter004",
|
2021-10-26 14:43:39 +03:00
|
|
|
"interpreter005", "interpreter006", "interpreter007", "interpreter008"]
|
2021-04-15 16:08:50 +03:00
|
|
|
|
2022-05-08 02:07:28 +03:00
|
|
|
idrisTestsAllSchemes : Requirement -> TestPool
|
|
|
|
idrisTestsAllSchemes cg = MkTestPool
|
|
|
|
("Test across all scheme backends: " ++ show cg ++ " instance")
|
|
|
|
[] (Just cg)
|
|
|
|
[ "scheme001"
|
|
|
|
]
|
|
|
|
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTestsAllBackends : Requirement -> TestPool
|
|
|
|
idrisTestsAllBackends cg = MkTestPool
|
|
|
|
("Test across all backends: " ++ show cg ++ " instance")
|
|
|
|
[] (Just cg)
|
2022-05-10 17:09:53 +03:00
|
|
|
-- RefC implements IEEE standard and distinguishes between 0.0 and -0.0
|
|
|
|
-- unlike other backends. So turn this test for now.
|
|
|
|
$ ([ "issue2362" ] <* guard (cg /= C))
|
|
|
|
++ [ -- Evaluator
|
2021-06-22 00:12:17 +03:00
|
|
|
"evaluator004",
|
|
|
|
-- Unfortunately the behaviour of Double is platform dependent so the
|
|
|
|
-- following test is turned off.
|
|
|
|
-- "evaluator005",
|
|
|
|
"basic048",
|
|
|
|
"perf006"]
|
|
|
|
|
2021-07-23 13:15:08 +03:00
|
|
|
idrisTestsTotality : TestPool
|
|
|
|
idrisTestsTotality = MkTestPool "Totality checking" [] Nothing
|
|
|
|
-- Positivity checking
|
|
|
|
["positivity001", "positivity002", "positivity003", "positivity004",
|
|
|
|
-- Totality checking
|
|
|
|
"total001", "total002", "total003", "total004", "total005",
|
2021-07-26 17:41:56 +03:00
|
|
|
"total006", "total007", "total008", "total009", "total010",
|
2021-12-08 19:08:26 +03:00
|
|
|
"total011", "total012", "total013"
|
2021-07-23 13:15:08 +03:00
|
|
|
]
|
|
|
|
|
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:
* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking
Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.
I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).
Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.
Original commit details:
* Add ability to evaluate open terms via Scheme
Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.
Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).
* Add scheme evaluation mode
Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.
* Bring support.rkt up to date
A couple of missing things required for interfacing with scheme objects
* More Scheme readback machinery
We need these things in the next version so that the next-but-one
version can have a scheme evaluator!
* Add top level interface to scheme based normaliser
Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.
* Bring Context up to date with changes in main
* Now need Idris 0.5.0 to build
* Add SNF type for scheme values
This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.
* Add Quote for scheme evaluator
So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.
* Add new 'scheme' evaluator mode at the REPL
Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator
* Fix name generation for new UN format
* Add scheme evaluator support to Racket
* Add another scheme eval test
With metavariables this time
* evaltiming now times execution too
This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!
* Fix whitespace errors
* Error handling when trying to evaluate Scheme
2021-09-24 22:38:55 +03:00
|
|
|
-- This will only work with an Idris compiled via Chez or Racket, but at
|
|
|
|
-- least for the moment we're not officially supporting self hosting any
|
|
|
|
-- other way. If we do, we'll need to have a way to disable these.
|
|
|
|
idrisTestsSchemeEval : TestPool
|
|
|
|
idrisTestsSchemeEval = MkTestPool "Scheme Evaluator" [] Nothing
|
2022-01-21 13:26:20 +03:00
|
|
|
["schemeeval001", "schemeeval002", "schemeeval003", "schemeeval004",
|
|
|
|
"schemeeval005", "schemeeval006"]
|
|
|
|
|
|
|
|
idrisTestsReflection : TestPool
|
|
|
|
idrisTestsReflection = MkTestPool "Quotation and Reflection" [] Nothing
|
|
|
|
["reflection001", "reflection002", "reflection003", "reflection004",
|
|
|
|
"reflection005", "reflection006", "reflection007", "reflection008",
|
|
|
|
"reflection009", "reflection010", "reflection011", "reflection012",
|
2022-07-04 10:58:18 +03:00
|
|
|
"reflection013", "reflection014", "reflection015", "reflection016",
|
|
|
|
"reflection017"
|
2022-01-21 13:26:20 +03:00
|
|
|
]
|
|
|
|
|
2022-03-31 19:19:29 +03:00
|
|
|
idrisTestsWith : TestPool
|
|
|
|
idrisTestsWith = MkTestPool "With abstraction" [] Nothing
|
|
|
|
[ "with001", "with002", "with004", "with005", "with006", "with007",
|
2022-04-07 11:30:23 +03:00
|
|
|
"with008", "with009", "with010"
|
2022-03-31 19:19:29 +03:00
|
|
|
]
|
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:
* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking
Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.
I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).
Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.
Original commit details:
* Add ability to evaluate open terms via Scheme
Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.
Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).
* Add scheme evaluation mode
Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.
* Bring support.rkt up to date
A couple of missing things required for interfacing with scheme objects
* More Scheme readback machinery
We need these things in the next version so that the next-but-one
version can have a scheme evaluator!
* Add top level interface to scheme based normaliser
Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.
* Bring Context up to date with changes in main
* Now need Idris 0.5.0 to build
* Add SNF type for scheme values
This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.
* Add Quote for scheme evaluator
So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.
* Add new 'scheme' evaluator mode at the REPL
Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator
* Fix name generation for new UN format
* Add scheme evaluator support to Racket
* Add another scheme eval test
With metavariables this time
* evaltiming now times execution too
This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!
* Fix whitespace errors
* Error handling when trying to evaluate Scheme
2021-09-24 22:38:55 +03:00
|
|
|
|
2022-07-07 19:14:00 +03:00
|
|
|
idrisTestsIPKG : TestPool
|
|
|
|
idrisTestsIPKG = MkTestPool "Package and .ipkg files" [] Nothing
|
|
|
|
["pkg001", "pkg002", "pkg003", "pkg004", "pkg005", "pkg006", "pkg007",
|
|
|
|
"pkg008", "pkg009", "pkg010", "pkg011", "pkg012"]
|
|
|
|
|
2020-12-08 01:51:33 +03:00
|
|
|
idrisTests : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
idrisTests = MkTestPool "Misc" [] Nothing
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Documentation strings
|
2022-03-08 21:14:40 +03:00
|
|
|
["docs001", "docs002", "docs003", "docs004", "docs005",
|
2021-05-03 18:16:12 +03:00
|
|
|
-- Eta equality
|
|
|
|
"eta001",
|
2020-12-08 01:51:33 +03:00
|
|
|
-- Modules and imports
|
2021-10-08 12:09:17 +03:00
|
|
|
"import001", "import002", "import003", "import004", "import005", "import006",
|
2021-10-26 17:51:34 +03:00
|
|
|
"import007",
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Implicit laziness, lazy evaluation
|
2021-03-16 13:18:13 +03:00
|
|
|
"lazy001", "lazy002",
|
2020-06-21 06:33:39 +03:00
|
|
|
-- Namespace blocks
|
2021-08-20 17:33:32 +03:00
|
|
|
"namespace001", "namespace002",
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Parameters blocks
|
2021-07-10 21:13:27 +03:00
|
|
|
"params001", "params002", "params003",
|
2020-05-19 20:25:18 +03:00
|
|
|
-- Larger programs arising from real usage. Typically things with
|
|
|
|
-- interesting interactions between features
|
|
|
|
"real001", "real002",
|
2022-01-21 13:26:20 +03:00
|
|
|
-- Inlining
|
|
|
|
"inlining001",
|
2020-05-22 21:26:10 +03:00
|
|
|
-- with-disambiguation
|
2021-04-25 20:56:08 +03:00
|
|
|
"with003",
|
|
|
|
-- pretty printing
|
2021-12-02 14:30:38 +03:00
|
|
|
"pretty001", "pretty002",
|
2022-07-07 11:54:52 +03:00
|
|
|
-- PrimIO
|
|
|
|
"primloop",
|
2021-06-25 16:04:46 +03:00
|
|
|
-- golden file testing
|
2022-04-04 12:20:48 +03:00
|
|
|
"golden001",
|
|
|
|
-- quantifiers
|
2022-07-08 16:16:25 +03:00
|
|
|
"quantifiers001",
|
|
|
|
-- unification
|
|
|
|
"unification001"
|
2022-04-04 12:20:48 +03:00
|
|
|
]
|
2020-05-19 20:25:18 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
typeddTests : IO TestPool
|
|
|
|
typeddTests = testsInDir "typedd-book" (const True) "Type Driven Development" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
|
2020-10-19 11:26:23 +03:00
|
|
|
chezTests : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
chezTests = MkTestPool "Chez backend" [] (Just Chez)
|
2021-02-05 19:16:20 +03:00
|
|
|
[ "chez001", "chez002", "chez003", "chez004", "chez005", "chez006"
|
|
|
|
, "chez007", "chez008", "chez009", "chez010", "chez011", "chez012"
|
|
|
|
, "chez013", "chez014", "chez015", "chez016", "chez017", "chez018"
|
|
|
|
, "chez019", "chez020", "chez021", "chez022", "chez023", "chez024"
|
|
|
|
, "chez025", "chez026", "chez027", "chez028", "chez029", "chez030"
|
2022-06-26 02:21:32 +03:00
|
|
|
, "chez031", "chez032", "chez033", "chez034", "chez035"
|
2021-02-05 19:16:20 +03:00
|
|
|
, "futures001"
|
2021-05-10 14:17:09 +03:00
|
|
|
, "bitops"
|
2021-05-04 10:22:06 +03:00
|
|
|
, "casts"
|
2021-09-08 18:46:19 +03:00
|
|
|
, "memo"
|
2021-05-04 10:22:06 +03:00
|
|
|
, "newints"
|
2021-06-04 12:35:07 +03:00
|
|
|
, "integers"
|
2021-02-05 19:16:20 +03:00
|
|
|
, "semaphores001"
|
|
|
|
, "semaphores002"
|
|
|
|
, "perf001"
|
|
|
|
, "reg001"
|
2021-07-02 15:13:50 +03:00
|
|
|
, "channels001", "channels002", "channels003", "channels004", "channels005"
|
2021-02-05 19:16:20 +03:00
|
|
|
]
|
2020-05-19 20:25:18 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
refcTests : IO TestPool
|
|
|
|
refcTests = testsInDir "refc" (const True) "Reference counting C backend" [] (Just C)
|
2021-02-02 17:01:19 +03:00
|
|
|
|
2021-01-13 23:54:43 +03:00
|
|
|
racketTests : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
racketTests = MkTestPool "Racket backend" [] (Just Racket)
|
2021-02-05 19:16:20 +03:00
|
|
|
[ "forkjoin001"
|
|
|
|
, "semaphores001", "semaphores002"
|
|
|
|
, "futures001"
|
2021-03-15 16:43:12 +03:00
|
|
|
, "mutex001", "mutex002", "mutex003", "mutex004", "mutex005"
|
2021-07-02 15:13:50 +03:00
|
|
|
, "conditions001" , "conditions002" , "conditions003" , "conditions004"
|
2021-03-15 16:43:12 +03:00
|
|
|
, "conditions005"
|
|
|
|
-- , "conditions006"
|
|
|
|
-- , "conditions007"
|
2021-02-05 19:16:20 +03:00
|
|
|
]
|
2021-01-13 23:54:43 +03:00
|
|
|
|
2020-10-19 11:26:23 +03:00
|
|
|
nodeTests : TestPool
|
2021-06-22 00:12:17 +03:00
|
|
|
nodeTests = MkTestPool "Node backend" [] (Just Node)
|
2020-12-08 01:51:33 +03:00
|
|
|
[ "node001", "node002", "node003", "node004", "node005", "node006"
|
|
|
|
, "node007", "node008", "node009", "node011", "node012", "node015"
|
2021-01-20 10:49:05 +03:00
|
|
|
, "node017", "node018", "node019", "node021", "node022", "node023"
|
2021-12-22 17:25:21 +03:00
|
|
|
, "node024", "node025", "node026", "node027"
|
2021-06-03 12:20:07 +03:00
|
|
|
, "perf001"
|
2020-12-08 01:51:33 +03:00
|
|
|
-- , "node14", "node020"
|
2021-05-25 14:07:46 +03:00
|
|
|
, "args"
|
2021-05-10 14:17:09 +03:00
|
|
|
, "bitops"
|
2021-05-04 10:22:06 +03:00
|
|
|
, "casts"
|
2021-09-08 18:46:19 +03:00
|
|
|
, "memo"
|
2021-10-14 15:34:41 +03:00
|
|
|
, "fastConcat"
|
2021-05-04 10:22:06 +03:00
|
|
|
, "newints"
|
2021-10-13 17:46:02 +03:00
|
|
|
, "reg001", "reg002"
|
2021-09-08 23:16:36 +03:00
|
|
|
, "stringcast"
|
2020-07-14 19:38:47 +03:00
|
|
|
, "syntax001"
|
2020-07-05 13:53:45 +03:00
|
|
|
, "tailrec001"
|
2022-01-08 08:53:46 +03:00
|
|
|
, "tailrec002"
|
2020-09-19 22:09:36 +03:00
|
|
|
, "idiom001"
|
2021-06-04 12:35:07 +03:00
|
|
|
, "integers"
|
2022-03-26 20:14:30 +03:00
|
|
|
, "doubles"
|
2021-08-24 17:43:22 +03:00
|
|
|
, "fix1839"
|
2021-09-16 17:35:29 +03:00
|
|
|
, "tailrec_libs"
|
2021-11-09 19:23:50 +03:00
|
|
|
, "nomangle001", "nomangle002"
|
2020-06-12 23:35:08 +03:00
|
|
|
]
|
2020-06-11 12:52:54 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
vmcodeInterpTests : IO TestPool
|
|
|
|
vmcodeInterpTests = testsInDir "vmcode" (const True) "VMCode interpreter" [] Nothing
|
2021-07-07 19:06:59 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
ideModeTests : IO TestPool
|
|
|
|
ideModeTests = testsInDir "ideMode" (const True) "IDE mode" [] Nothing
|
2020-06-11 12:52:54 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
preludeTests : IO TestPool
|
|
|
|
preludeTests = testsInDir "prelude" (const True) "Prelude library" [] Nothing
|
2020-05-19 20:25:18 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
templateTests : IO TestPool
|
|
|
|
templateTests = testsInDir "templates" (const True) "Test templates" [] Nothing
|
2020-11-27 18:40:02 +03:00
|
|
|
|
2021-02-18 14:13:25 +03:00
|
|
|
-- base library tests are run against
|
|
|
|
-- each codegen supported and to keep
|
|
|
|
-- things simple it's all one test group
|
|
|
|
-- that only runs if all backends are
|
|
|
|
-- available.
|
2021-07-16 19:06:14 +03:00
|
|
|
baseLibraryTests : IO TestPool
|
|
|
|
baseLibraryTests = testsInDir "base" (const True) "Base library" [Chez, Node] Nothing
|
2021-02-18 14:13:25 +03:00
|
|
|
|
2021-04-22 10:30:56 +03:00
|
|
|
-- same behavior as `baseLibraryTests`
|
2021-07-16 19:06:14 +03:00
|
|
|
contribLibraryTests : IO TestPool
|
|
|
|
contribLibraryTests = testsInDir "contrib" (const True) "Contrib library" [Chez, Node] Nothing
|
2021-04-22 10:30:56 +03:00
|
|
|
|
2021-07-16 19:06:14 +03:00
|
|
|
codegenTests : IO TestPool
|
|
|
|
codegenTests = testsInDir "codegen" (const True) "Code generation" [] Nothing
|
2021-03-29 17:08:06 +03:00
|
|
|
|
2020-05-19 20:25:18 +03:00
|
|
|
main : IO ()
|
2021-06-22 00:12:17 +03:00
|
|
|
main = runner $
|
2020-10-19 11:26:23 +03:00
|
|
|
[ testPaths "ttimp" ttimpTests
|
2020-12-08 01:51:33 +03:00
|
|
|
, testPaths "idris2" idrisTestsBasic
|
|
|
|
, testPaths "idris2" idrisTestsCoverage
|
2022-09-01 12:47:12 +03:00
|
|
|
, testPaths "idris2" idrisTestsTermination
|
2021-02-26 12:33:07 +03:00
|
|
|
, testPaths "idris2" idrisTestsCasetree
|
2020-12-08 01:51:33 +03:00
|
|
|
, testPaths "idris2" idrisTestsError
|
2022-04-07 13:23:05 +03:00
|
|
|
, testPaths "idris2" idrisTestsFailing
|
2021-05-14 19:35:21 +03:00
|
|
|
, testPaths "idris2" idrisTestsWarning
|
2020-12-08 01:51:33 +03:00
|
|
|
, testPaths "idris2" idrisTestsInteractive
|
|
|
|
, testPaths "idris2" idrisTestsInterface
|
|
|
|
, testPaths "idris2" idrisTestsLiterate
|
|
|
|
, testPaths "idris2" idrisTestsLinear
|
|
|
|
, testPaths "idris2" idrisTestsPerformance
|
|
|
|
, testPaths "idris2" idrisTestsRegression
|
2021-03-31 19:57:31 +03:00
|
|
|
, testPaths "idris2" idrisTestsData
|
2021-04-22 15:08:32 +03:00
|
|
|
, testPaths "idris2" idrisTestsBuiltin
|
2021-04-15 16:08:50 +03:00
|
|
|
, testPaths "idris2" idrisTestsEvaluator
|
2021-07-23 13:15:08 +03:00
|
|
|
, testPaths "idris2" idrisTestsTotality
|
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:
* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking
Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.
I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).
Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.
Original commit details:
* Add ability to evaluate open terms via Scheme
Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.
Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).
* Add scheme evaluation mode
Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.
* Bring support.rkt up to date
A couple of missing things required for interfacing with scheme objects
* More Scheme readback machinery
We need these things in the next version so that the next-but-one
version can have a scheme evaluator!
* Add top level interface to scheme based normaliser
Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.
* Bring Context up to date with changes in main
* Now need Idris 0.5.0 to build
* Add SNF type for scheme values
This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.
* Add Quote for scheme evaluator
So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.
* Add new 'scheme' evaluator mode at the REPL
Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator
* Fix name generation for new UN format
* Add scheme evaluator support to Racket
* Add another scheme eval test
With metavariables this time
* evaltiming now times execution too
This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!
* Fix whitespace errors
* Error handling when trying to evaluate Scheme
2021-09-24 22:38:55 +03:00
|
|
|
, testPaths "idris2" idrisTestsSchemeEval
|
2022-01-21 13:26:20 +03:00
|
|
|
, testPaths "idris2" idrisTestsReflection
|
2022-03-31 19:19:29 +03:00
|
|
|
, testPaths "idris2" idrisTestsWith
|
2022-04-29 14:52:23 +03:00
|
|
|
, testPaths "idris2" idrisTestsDebug
|
2022-07-07 19:14:00 +03:00
|
|
|
, testPaths "idris2" idrisTestsIPKG
|
2020-10-19 11:26:23 +03:00
|
|
|
, testPaths "idris2" idrisTests
|
2021-07-16 19:06:14 +03:00
|
|
|
, !typeddTests
|
|
|
|
, !ideModeTests
|
|
|
|
, !preludeTests
|
|
|
|
, !baseLibraryTests
|
|
|
|
, !contribLibraryTests
|
2020-10-19 11:26:23 +03:00
|
|
|
, testPaths "chez" chezTests
|
2021-07-16 19:06:14 +03:00
|
|
|
, !refcTests
|
2021-01-13 23:54:43 +03:00
|
|
|
, testPaths "racket" racketTests
|
2020-10-19 11:26:23 +03:00
|
|
|
, testPaths "node" nodeTests
|
2021-07-16 19:06:14 +03:00
|
|
|
, !vmcodeInterpTests
|
|
|
|
, !templateTests
|
|
|
|
, !codegenTests
|
2021-06-22 00:12:17 +03:00
|
|
|
]
|
2022-05-08 02:07:28 +03:00
|
|
|
++ map (testPaths "allschemes" . idrisTestsAllSchemes) [Chez, Racket]
|
2022-05-10 17:09:53 +03:00
|
|
|
++ map (testPaths "allbackends" . idrisTestsAllBackends) [Chez, Node, Racket, C]
|
2021-06-22 00:12:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
where
|
2020-10-19 11:26:23 +03:00
|
|
|
|
|
|
|
testPaths : String -> TestPool -> TestPool
|
2021-12-16 21:23:18 +03:00
|
|
|
testPaths dir = { testCases $= map ((dir ++ "/") ++) }
|