1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-02 10:47:32 +03:00

Add option to run Anoma tests in non-debug mode (#3144)

> ⚠️ Based on https://github.com/anoma/juvix/pull/3142

When using AnomaTestModeFull the compilation tests are run in debug
mode, with stdlib interception and run using the raw nock (without
stdlib interception).

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
This commit is contained in:
Paul Cadman 2024-11-07 13:11:41 +00:00 committed by GitHub
parent 0714391900
commit 6ed5e136b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 146 additions and 41 deletions

View File

@ -259,6 +259,25 @@ isAtom = not . isCell
atomHint :: Lens' (Atom a) (Maybe AtomHint) atomHint :: Lens' (Atom a) (Maybe AtomHint)
atomHint = atomInfo . atomInfoHint atomHint = atomInfo . atomInfoHint
-- | Removes all extra information recursively
removeInfoRec :: Term a -> Term a
removeInfoRec = go
where
go :: Term a -> Term a
go = \case
TermAtom a -> TermAtom (goAtom a)
TermCell a -> TermCell (goCell a)
goAtom :: Atom a -> Atom a
goAtom (Atom _atom _) =
Atom
{ _atomInfo = emptyAtomInfo,
_atom
}
goCell :: Cell a -> Cell a
goCell (Cell l r) = Cell (go l) (go r)
termLoc :: Lens' (Term a) (Maybe Interval) termLoc :: Lens' (Term a) (Maybe Interval)
termLoc f = \case termLoc f = \case
TermAtom a -> TermAtom <$> atomLoc f a TermAtom a -> TermAtom <$> atomLoc f a

View File

@ -104,27 +104,35 @@ compileMain enableDebug relRoot mainFile rootCopyDir = do
entryPoint <- entryPoint <-
set entryPointTarget (Just TargetAnoma) . set entryPointDebug enableDebug set entryPointTarget (Just TargetAnoma) . set entryPointDebug enableDebug
<$> testDefaultEntryPointIO testRootDir (testRootDir <//> mainFile) <$> testDefaultEntryPointIO testRootDir (testRootDir <//> mainFile)
(^. pipelineResult) . snd <$> testRunIO entryPoint upToAnoma (over anomaClosure removeInfoUnlessDebug) . (^. pipelineResult) . snd <$> testRunIO entryPoint upToAnoma
where
removeInfoUnlessDebug :: Term Natural -> Term Natural
removeInfoUnlessDebug
| enableDebug = id
| otherwise = removeInfoRec
mkAnomaTestNoDebug :: data AnomaTestMode
Int -> = -- | We only run the tests in debug mode, where calls to stdlib are intercepted
Text -> AnomaTestModeDebugOnly
Prelude.Path Rel Dir -> | -- | We run the tests in debug mode and in non-debug mode, where no stdlib
Prelude.Path Rel File -> -- calls are intercepted. Only tests that run fast can use this mode
[Term Natural] -> AnomaTestModeFull
Check () ->
AnomaTest
mkAnomaTestNoDebug = mkAnomaTest' False emptyStorage
mkAnomaTest :: mkAnomaTest ::
Int -> Int ->
AnomaTestMode ->
Text -> Text ->
Prelude.Path Rel Dir -> Prelude.Path Rel Dir ->
Prelude.Path Rel File -> Prelude.Path Rel File ->
[Term Natural] -> [Term Natural] ->
Check () -> Check () ->
AnomaTest [AnomaTest]
mkAnomaTest = mkAnomaTest' True emptyStorage mkAnomaTest testNum testMode testName' dirPath filePath args check =
let debugTest = mkAnomaTest' True emptyStorage testNum (testName' <> " - debug") dirPath filePath args check
nonDebugTest = mkAnomaTest' False emptyStorage testNum testName' dirPath filePath args check
in case testMode of
AnomaTestModeDebugOnly -> [debugTest]
AnomaTestModeFull -> [debugTest, nonDebugTest]
checkNatOutput :: [Natural] -> Check () checkNatOutput :: [Natural] -> Check ()
checkNatOutput = checkOutput . fmap toNock checkNatOutput = checkOutput . fmap toNock
@ -253,7 +261,8 @@ allTests =
(map mkAnomaNodeTest (filter shouldRun anomaTests)) (map mkAnomaNodeTest (filter shouldRun anomaTests))
where where
shouldRun :: AnomaTest -> Bool shouldRun :: AnomaTest -> Bool
shouldRun a = classify a == ClassWorking shouldRun a =
classify a == ClassWorking
haskellNockmaTests :: TestTree haskellNockmaTests :: TestTree
haskellNockmaTests = haskellNockmaTests =
@ -264,10 +273,15 @@ allTests =
natArg :: Natural -> Term Natural natArg :: Natural -> Term Natural
natArg = toNock natArg = toNock
-- added this to minimize git diff
anomaTests :: [AnomaTest] anomaTests :: [AnomaTest]
anomaTests = anomaTests = concat anomaTests'
anomaTests' :: [[AnomaTest]]
anomaTests' =
[ mkAnomaTest [ mkAnomaTest
1 1
AnomaTestModeFull
"Arithmetic operators" "Arithmetic operators"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test001.juvix") $(mkRelFile "test001.juvix")
@ -275,6 +289,7 @@ allTests =
(checkNatOutput [11]), (checkNatOutput [11]),
mkAnomaTest mkAnomaTest
2 2
AnomaTestModeFull
"Arithmetic operators inside lambdas" "Arithmetic operators inside lambdas"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test002.juvix") $(mkRelFile "test002.juvix")
@ -282,20 +297,15 @@ allTests =
(checkNatOutput [11]), (checkNatOutput [11]),
mkAnomaTest mkAnomaTest
3 3
AnomaTestModeFull
"Integer arithmetic" "Integer arithmetic"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test003.juvix") $(mkRelFile "test003.juvix")
[] []
(checkNatOutput [1, 4, 2, 4, 0]), (checkNatOutput [1, 4, 2, 4, 0]),
mkAnomaTestNoDebug
3
"Integer arithmetic - no debug"
$(mkRelDir ".")
$(mkRelFile "test003.juvix")
[]
(checkNatOutput [1, 4, 2, 4, 0]),
mkAnomaTest mkAnomaTest
5 5
AnomaTestModeFull
"Higher-order functions" "Higher-order functions"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test005.juvix") $(mkRelFile "test005.juvix")
@ -303,6 +313,7 @@ allTests =
(checkNatOutput [6]), (checkNatOutput [6]),
mkAnomaTest mkAnomaTest
6 6
AnomaTestModeFull
"If-then-else and lazy boolean operators" "If-then-else and lazy boolean operators"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test006.juvix") $(mkRelFile "test006.juvix")
@ -310,6 +321,7 @@ allTests =
(checkOutput [[nock| 2 |], [nock| true |], [nock| false |]]), (checkOutput [[nock| 2 |], [nock| true |], [nock| false |]]),
mkAnomaTest mkAnomaTest
7 7
AnomaTestModeFull
"Pattern matching and lambda-case" "Pattern matching and lambda-case"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test007.juvix") $(mkRelFile "test007.juvix")
@ -319,6 +331,7 @@ allTests =
checkOutput [[nock| false |], [nock| true |], [nock| 0 |], [nock| [1 nil] |], [nock| 1 |], l, l], checkOutput [[nock| false |], [nock| true |], [nock| 0 |], [nock| [1 nil] |], [nock| 1 |], l, l],
mkAnomaTest mkAnomaTest
8 8
AnomaTestModeDebugOnly
"Recursion" "Recursion"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test008.juvix") $(mkRelFile "test008.juvix")
@ -326,6 +339,7 @@ allTests =
(eqNock [nock| 500500 |]), (eqNock [nock| 500500 |]),
mkAnomaTest mkAnomaTest
9 9
AnomaTestModeDebugOnly
"Tail recursion" "Tail recursion"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test009.juvix") $(mkRelFile "test009.juvix")
@ -333,6 +347,7 @@ allTests =
$ checkNatOutput [500500, 120, 3628800, 479001600], $ checkNatOutput [500500, 120, 3628800, 479001600],
mkAnomaTest mkAnomaTest
10 10
AnomaTestModeFull
"Let" "Let"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test010.juvix") $(mkRelFile "test010.juvix")
@ -340,6 +355,7 @@ allTests =
(checkNatOutput [32]), (checkNatOutput [32]),
mkAnomaTest mkAnomaTest
11 11
AnomaTestModeDebugOnly
"Tail recursion: Fibonacci numbers in linear time" "Tail recursion: Fibonacci numbers in linear time"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test011.juvix") $(mkRelFile "test011.juvix")
@ -351,6 +367,7 @@ allTests =
checkNatOutput [fib10, fib100, fib1000], checkNatOutput [fib10, fib100, fib1000],
mkAnomaTest mkAnomaTest
12 12
AnomaTestModeDebugOnly
"Trees" "Trees"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test012.juvix") $(mkRelFile "test012.juvix")
@ -364,6 +381,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
13 13
AnomaTestModeFull
"Functions returning functions with variable capture" "Functions returning functions with variable capture"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test013.juvix") $(mkRelFile "test013.juvix")
@ -371,6 +389,7 @@ allTests =
$ checkNatOutput [1, 0, 2, 5], $ checkNatOutput [1, 0, 2, 5],
mkAnomaTest mkAnomaTest
14 14
AnomaTestModeFull
"Arithmetic" "Arithmetic"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test014.juvix") $(mkRelFile "test014.juvix")
@ -378,6 +397,7 @@ allTests =
$ checkNatOutput [7, 17, 37, 31], $ checkNatOutput [7, 17, 37, 31],
mkAnomaTest mkAnomaTest
15 15
AnomaTestModeFull
"Local functions with free variables" "Local functions with free variables"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test015.juvix") $(mkRelFile "test015.juvix")
@ -385,6 +405,7 @@ allTests =
$ checkNatOutput [600, 25, 30, 45, 55, 16], $ checkNatOutput [600, 25, 30, 45, 55, 16],
mkAnomaTest mkAnomaTest
16 16
AnomaTestModeFull
"Recursion through higher-order functions" "Recursion through higher-order functions"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test016.juvix") $(mkRelFile "test016.juvix")
@ -392,6 +413,7 @@ allTests =
$ checkNatOutput [55], $ checkNatOutput [55],
mkAnomaTest mkAnomaTest
17 17
AnomaTestModeDebugOnly
"Tail recursion through higher-order functions" "Tail recursion through higher-order functions"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test017.juvix") $(mkRelFile "test017.juvix")
@ -399,6 +421,7 @@ allTests =
$ checkNatOutput [500500], $ checkNatOutput [500500],
mkAnomaTest mkAnomaTest
18 18
AnomaTestModeFull
"Higher-order functions and recursion" "Higher-order functions and recursion"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test018.juvix") $(mkRelFile "test018.juvix")
@ -406,6 +429,7 @@ allTests =
$ checkNatOutput [11], $ checkNatOutput [11],
mkAnomaTest mkAnomaTest
19 19
AnomaTestModeFull
"Self-application" "Self-application"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test019.juvix") $(mkRelFile "test019.juvix")
@ -413,6 +437,7 @@ allTests =
$ checkNatOutput [7], $ checkNatOutput [7],
mkAnomaTest mkAnomaTest
20 20
AnomaTestModeDebugOnly
"Recursive functions: McCarthy's 91 function, subtraction by increments" "Recursive functions: McCarthy's 91 function, subtraction by increments"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test020.juvix") $(mkRelFile "test020.juvix")
@ -420,6 +445,7 @@ allTests =
$ checkNatOutput [91, 91, 91, 91, 100, 6, 6, 400, 4000], $ checkNatOutput [91, 91, 91, 91, 100, 6, 6, 400, 4000],
mkAnomaTest mkAnomaTest
21 21
AnomaTestModeDebugOnly
"Fast exponentiation" "Fast exponentiation"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test021.juvix") $(mkRelFile "test021.juvix")
@ -427,6 +453,7 @@ allTests =
$ checkNatOutput [8, 2187, 48828125], $ checkNatOutput [8, 2187, 48828125],
mkAnomaTest mkAnomaTest
22 22
AnomaTestModeDebugOnly
"Lists" "Lists"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test022.juvix") $(mkRelFile "test022.juvix")
@ -441,6 +468,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
23 23
AnomaTestModeDebugOnly
"Mutual recursion" "Mutual recursion"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test023.juvix") $(mkRelFile "test023.juvix")
@ -448,6 +476,7 @@ allTests =
$ checkNatOutput [32, 869, 6385109], $ checkNatOutput [32, 869, 6385109],
mkAnomaTest mkAnomaTest
24 24
AnomaTestModeDebugOnly
"Nested binders with variable capture" "Nested binders with variable capture"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test024.juvix") $(mkRelFile "test024.juvix")
@ -455,6 +484,7 @@ allTests =
$ checkNatOutput [6688], $ checkNatOutput [6688],
mkAnomaTest mkAnomaTest
25 25
AnomaTestModeDebugOnly
"Euclid's algorithm" "Euclid's algorithm"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test025.juvix") $(mkRelFile "test025.juvix")
@ -462,6 +492,7 @@ allTests =
$ checkNatOutput [14, 70, 1, 1, 1], $ checkNatOutput [14, 70, 1, 1, 1],
mkAnomaTest mkAnomaTest
26 26
AnomaTestModeFull
"Functional queues" "Functional queues"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test026.juvix") $(mkRelFile "test026.juvix")
@ -470,12 +501,14 @@ allTests =
-- TODO allow lambda branches of different number of patterns -- TODO allow lambda branches of different number of patterns
-- mkAnomaTest -- mkAnomaTest
-- "Test027: Church numerals" -- "Test027: Church numerals"
-- AnomaTestModeFull
-- $(mkRelDir ".") -- $(mkRelDir ".")
-- $(mkRelFile "test027.juvix") -- $(mkRelFile "test027.juvix")
-- [] -- []
-- $ checkNatOutput [7, 10, 21], -- $ checkNatOutput [7, 10, 21],
mkAnomaTest mkAnomaTest
28 28
AnomaTestModeDebugOnly
"Streams without memoization" "Streams without memoization"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test028.juvix") $(mkRelFile "test028.juvix")
@ -483,6 +516,7 @@ allTests =
$ checkNatOutput [31, 233], $ checkNatOutput [31, 233],
mkAnomaTest mkAnomaTest
29 29
AnomaTestModeFull
"Ackermann function" "Ackermann function"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test029.juvix") $(mkRelFile "test029.juvix")
@ -490,6 +524,7 @@ allTests =
$ checkNatOutput [8, 9, 15, 17, 29], $ checkNatOutput [8, 9, 15, 17, 29],
mkAnomaTest mkAnomaTest
30 30
AnomaTestModeDebugOnly
"Ackermann function (higher-order definition)" "Ackermann function (higher-order definition)"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test030.juvix") $(mkRelFile "test030.juvix")
@ -497,6 +532,7 @@ allTests =
$ checkNatOutput [10, 21, 2187, 15], $ checkNatOutput [10, 21, 2187, 15],
mkAnomaTest mkAnomaTest
31 31
AnomaTestModeFull
"Nested lists" "Nested lists"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test031.juvix") $(mkRelFile "test031.juvix")
@ -504,6 +540,7 @@ allTests =
$ checkOutput [[nock| [4 3 2 1 3 2 1 2 1 1 nil ] |]], $ checkOutput [[nock| [4 3 2 1 3 2 1 2 1 1 nil ] |]],
mkAnomaTest mkAnomaTest
32 32
AnomaTestModeDebugOnly
"Merge sort" "Merge sort"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test032.juvix") $(mkRelFile "test032.juvix")
@ -513,6 +550,7 @@ allTests =
checkOutput [l, l, l], checkOutput [l, l, l],
mkAnomaTest mkAnomaTest
33 33
AnomaTestModeFull
"Eta-expansion of builtins and constructors" "Eta-expansion of builtins and constructors"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test033.juvix") $(mkRelFile "test033.juvix")
@ -526,6 +564,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
34 34
AnomaTestModeDebugOnly
"Recursive let" "Recursive let"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test034.juvix") $(mkRelFile "test034.juvix")
@ -533,6 +572,7 @@ allTests =
$ checkNatOutput [500500, 32, 869, 41, 85], $ checkNatOutput [500500, 32, 869, 41, 85],
mkAnomaTest mkAnomaTest
35 35
AnomaTestModeDebugOnly
"Pattern matching" "Pattern matching"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test035.juvix") $(mkRelFile "test035.juvix")
@ -547,6 +587,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
36 36
AnomaTestModeFull
"Eta-expansion" "Eta-expansion"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test036.juvix") $(mkRelFile "test036.juvix")
@ -554,6 +595,7 @@ allTests =
$ checkNatOutput [18], $ checkNatOutput [18],
mkAnomaTest mkAnomaTest
37 37
AnomaTestModeFull
"Applications with lets and cases in function position" "Applications with lets and cases in function position"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test037.juvix") $(mkRelFile "test037.juvix")
@ -561,6 +603,7 @@ allTests =
$ checkNatOutput [9], $ checkNatOutput [9],
mkAnomaTest mkAnomaTest
38 38
AnomaTestModeFull
"Simple case expression" "Simple case expression"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test038.juvix") $(mkRelFile "test038.juvix")
@ -568,6 +611,7 @@ allTests =
$ checkNatOutput [1], $ checkNatOutput [1],
mkAnomaTest mkAnomaTest
39 39
AnomaTestModeFull
"Mutually recursive let expression" "Mutually recursive let expression"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test039.juvix") $(mkRelFile "test039.juvix")
@ -575,6 +619,7 @@ allTests =
$ checkOutput [[nock| false |], [nock| true |]], $ checkOutput [[nock| false |], [nock| true |]],
mkAnomaTest mkAnomaTest
40 40
AnomaTestModeFull
"Pattern matching nullary constructor" "Pattern matching nullary constructor"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test040.juvix") $(mkRelFile "test040.juvix")
@ -582,6 +627,7 @@ allTests =
$ checkOutput [[nock| true |]], $ checkOutput [[nock| true |]],
mkAnomaTest mkAnomaTest
41 41
AnomaTestModeFull
"Use a builtin inductive in an inductive constructor" "Use a builtin inductive in an inductive constructor"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test041.juvix") $(mkRelFile "test041.juvix")
@ -589,6 +635,7 @@ allTests =
$ checkNatOutput [6], $ checkNatOutput [6],
mkAnomaTest mkAnomaTest
43 43
AnomaTestModeFull
"Builtin trace" "Builtin trace"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test043.juvix") $(mkRelFile "test043.juvix")
@ -596,6 +643,7 @@ allTests =
$ checkNatOutput [0, 1], $ checkNatOutput [0, 1],
mkAnomaTest mkAnomaTest
45 45
AnomaTestModeFull
"Implicit builtin bool" "Implicit builtin bool"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test045.juvix") $(mkRelFile "test045.juvix")
@ -603,6 +651,7 @@ allTests =
$ checkNatOutput [4], $ checkNatOutput [4],
mkAnomaTest mkAnomaTest
46 46
AnomaTestModeFull
"Polymorphic type arguments" "Polymorphic type arguments"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test046.juvix") $(mkRelFile "test046.juvix")
@ -610,6 +659,7 @@ allTests =
$ checkNatOutput [7], $ checkNatOutput [7],
mkAnomaTest mkAnomaTest
47 47
AnomaTestModeFull
"Local Modules" "Local Modules"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test047.juvix") $(mkRelFile "test047.juvix")
@ -617,6 +667,7 @@ allTests =
$ checkNatOutput [660], $ checkNatOutput [660],
mkAnomaTest mkAnomaTest
49 49
AnomaTestModeFull
"Builtin Int" "Builtin Int"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test049.juvix") $(mkRelFile "test049.juvix")
@ -642,6 +693,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
50 50
AnomaTestModeFull
"Pattern matching with integers" "Pattern matching with integers"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test050.juvix") $(mkRelFile "test050.juvix")
@ -649,6 +701,7 @@ allTests =
$ checkNatOutput [11], $ checkNatOutput [11],
mkAnomaTest mkAnomaTest
52 52
AnomaTestModeFull
"Simple lambda calculus" "Simple lambda calculus"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test052.juvix") $(mkRelFile "test052.juvix")
@ -656,6 +709,7 @@ allTests =
$ checkOutput [[nock| [15 nil] |]], $ checkOutput [[nock| [15 nil] |]],
mkAnomaTest mkAnomaTest
53 53
AnomaTestModeFull
"Inlining" "Inlining"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test053.juvix") $(mkRelFile "test053.juvix")
@ -663,6 +717,7 @@ allTests =
$ checkNatOutput [21], $ checkNatOutput [21],
mkAnomaTest mkAnomaTest
54 54
AnomaTestModeFull
"Iterators" "Iterators"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test054.juvix") $(mkRelFile "test054.juvix")
@ -670,6 +725,7 @@ allTests =
$ checkNatOutput [189], $ checkNatOutput [189],
mkAnomaTest mkAnomaTest
55 55
AnomaTestModeFull
"Constructor printing" "Constructor printing"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test055.juvix") $(mkRelFile "test055.juvix")
@ -678,6 +734,7 @@ allTests =
[[nock| [[[[1 2] 3] [[2 3] 4] nil] [1 2] [2 3] nil] |]], [[nock| [[[[1 2] 3] [[2 3] 4] nil] [1 2] [2 3] nil] |]],
mkAnomaTest mkAnomaTest
56 56
AnomaTestModeFull
"Argument specialization" "Argument specialization"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test056.juvix") $(mkRelFile "test056.juvix")
@ -685,6 +742,7 @@ allTests =
$ checkNatOutput [69], $ checkNatOutput [69],
mkAnomaTest mkAnomaTest
57 57
AnomaTestModeFull
"Case folding" "Case folding"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test057.juvix") $(mkRelFile "test057.juvix")
@ -692,6 +750,7 @@ allTests =
$ checkNatOutput [8], $ checkNatOutput [8],
mkAnomaTest mkAnomaTest
58 58
AnomaTestModeDebugOnly
"Ranges" "Ranges"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test058.juvix") $(mkRelFile "test058.juvix")
@ -699,6 +758,7 @@ allTests =
$ checkNatOutput [7550], $ checkNatOutput [7550],
mkAnomaTest mkAnomaTest
59 59
AnomaTestModeFull
"Builtin list" "Builtin list"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test059.juvix") $(mkRelFile "test059.juvix")
@ -706,6 +766,7 @@ allTests =
$ checkNatOutput [11], $ checkNatOutput [11],
mkAnomaTest mkAnomaTest
60 60
AnomaTestModeFull
"Record update" "Record update"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test060.juvix") $(mkRelFile "test060.juvix")
@ -713,6 +774,7 @@ allTests =
$ checkOutput [[nock| [30 10 2] |]], $ checkOutput [[nock| [30 10 2] |]],
mkAnomaTest mkAnomaTest
61 61
AnomaTestModeFull
"Traits" "Traits"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test061.juvix") $(mkRelFile "test061.juvix")
@ -720,6 +782,7 @@ allTests =
$ checkNatOutput [1, 0, 3, 5, 1, 6, 5, 3, 1, 1, 6, 1, 3], $ checkNatOutput [1, 0, 3, 5, 1, 6, 5, 3, 1, 1, 6, 1, 3],
mkAnomaTest mkAnomaTest
62 62
AnomaTestModeFull
"Overapplication" "Overapplication"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test062.juvix") $(mkRelFile "test062.juvix")
@ -727,6 +790,7 @@ allTests =
$ checkNatOutput [1], $ checkNatOutput [1],
mkAnomaTest mkAnomaTest
63 63
AnomaTestModeFull
"Coercions" "Coercions"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test063.juvix") $(mkRelFile "test063.juvix")
@ -734,6 +798,7 @@ allTests =
$ checkNatOutput [0, 1, 2, 300, 4, 5, 6, 7], $ checkNatOutput [0, 1, 2, 300, 4, 5, 6, 7],
mkAnomaTest mkAnomaTest
64 64
AnomaTestModeFull
"Constant folding" "Constant folding"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test064.juvix") $(mkRelFile "test064.juvix")
@ -741,6 +806,7 @@ allTests =
$ checkNatOutput [37], $ checkNatOutput [37],
mkAnomaTest mkAnomaTest
65 65
AnomaTestModeFull
"Arithmetic simplification" "Arithmetic simplification"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test065.juvix") $(mkRelFile "test065.juvix")
@ -748,6 +814,7 @@ allTests =
$ checkNatOutput [42], $ checkNatOutput [42],
mkAnomaTest mkAnomaTest
66 66
AnomaTestModeFull
"Import function with a function call in default argument" "Import function with a function call in default argument"
$(mkRelDir "test066") $(mkRelDir "test066")
$(mkRelFile "M.juvix") $(mkRelFile "M.juvix")
@ -755,6 +822,7 @@ allTests =
$ checkNatOutput [0], $ checkNatOutput [0],
mkAnomaTest mkAnomaTest
67 67
AnomaTestModeFull
"Dependent default values inserted during translation FromConcrete" "Dependent default values inserted during translation FromConcrete"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test067.juvix") $(mkRelFile "test067.juvix")
@ -762,6 +830,7 @@ allTests =
$ checkNatOutput [30], $ checkNatOutput [30],
mkAnomaTest mkAnomaTest
68 68
AnomaTestModeFull
"Dependent default values inserted in the arity checker" "Dependent default values inserted in the arity checker"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test068.juvix") $(mkRelFile "test068.juvix")
@ -769,6 +838,7 @@ allTests =
$ checkNatOutput [30], $ checkNatOutput [30],
mkAnomaTest mkAnomaTest
69 69
AnomaTestModeFull
"Dependent default values for Ord trait" "Dependent default values for Ord trait"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test069.juvix") $(mkRelFile "test069.juvix")
@ -776,6 +846,7 @@ allTests =
$ checkOutput [[nock| true |]], $ checkOutput [[nock| true |]],
mkAnomaTest mkAnomaTest
70 70
AnomaTestModeFull
"Nested default values and named arguments" "Nested default values and named arguments"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test070.juvix") $(mkRelFile "test070.juvix")
@ -783,6 +854,7 @@ allTests =
$ checkNatOutput [1463], $ checkNatOutput [1463],
mkAnomaTest mkAnomaTest
71 71
AnomaTestModeFull
"Named application (Ord instance with default cmp)" "Named application (Ord instance with default cmp)"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test071.juvix") $(mkRelFile "test071.juvix")
@ -790,6 +862,7 @@ allTests =
$ checkNatOutput [1528], $ checkNatOutput [1528],
mkAnomaTest mkAnomaTest
72 72
AnomaTestModeFull
"Monad transformers (ReaderT + StateT + Identity)" "Monad transformers (ReaderT + StateT + Identity)"
$(mkRelDir "test072") $(mkRelDir "test072")
$(mkRelFile "ReaderT.juvix") $(mkRelFile "ReaderT.juvix")
@ -797,6 +870,7 @@ allTests =
$ checkNatOutput [10], $ checkNatOutput [10],
mkAnomaTest mkAnomaTest
73 73
AnomaTestModeFull
"Import and use a syntax alias" "Import and use a syntax alias"
$(mkRelDir "test073") $(mkRelDir "test073")
$(mkRelFile "test073.juvix") $(mkRelFile "test073.juvix")
@ -810,23 +884,25 @@ allTests =
-- The id is captured from the arguments tuple of the function. -- The id is captured from the arguments tuple of the function.
sk1 :: Term Natural = [nock| [[333 1 2 3 nil] 333 nil] |] sk1 :: Term Natural = [nock| [[333 1 2 3 nil] 333 nil] |]
sk2 :: Term Natural = [nock| [[333 1 2 3 nil] [1 2 3 nil] nil] |] sk2 :: Term Natural = [nock| [[333 1 2 3 nil] [1 2 3 nil] nil] |]
in mkAnomaTest' in [ mkAnomaTest'
True True
( Storage ( Storage
( hashMap ( hashMap
[ (StorageKey sk1, v1), [ (StorageKey sk1, v1),
(StorageKey sk2, v2) (StorageKey sk2, v2)
] ]
) )
) )
74 74
"Builtin anomaGet" "Builtin anomaGet"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test074.juvix") $(mkRelFile "test074.juvix")
[k1, k2] [k1, k2]
$ checkOutput [v1, v2], $ checkOutput [v1, v2]
],
mkAnomaTest mkAnomaTest
75 75
AnomaTestModeDebugOnly
"Anoma encode" "Anoma encode"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test075.juvix") $(mkRelFile "test075.juvix")
@ -834,6 +910,7 @@ allTests =
$ checkNatOutput [2, 84081, 4657, 12], $ checkNatOutput [2, 84081, 4657, 12],
mkAnomaTest mkAnomaTest
76 76
AnomaTestModeDebugOnly
"Anoma decode" "Anoma decode"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test076.juvix") $(mkRelFile "test076.juvix")
@ -846,6 +923,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
77 77
AnomaTestModeDebugOnly
"Anoma verify-detached" "Anoma verify-detached"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test077.juvix") $(mkRelFile "test077.juvix")
@ -857,6 +935,7 @@ allTests =
let toSignAndVerify :: Term Natural = [nock| [1 2 nil] |] let toSignAndVerify :: Term Natural = [nock| [1 2 nil] |]
in mkAnomaTest in mkAnomaTest
78 78
AnomaTestModeDebugOnly
"Anoma sign and verify" "Anoma sign and verify"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test078.juvix") $(mkRelFile "test078.juvix")
@ -866,6 +945,7 @@ allTests =
let inputStr :: Term Natural = [nock| "Juvix!" |] let inputStr :: Term Natural = [nock| "Juvix!" |]
in mkAnomaTest in mkAnomaTest
79 79
AnomaTestModeDebugOnly
"Strings" "Strings"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test079.juvix") $(mkRelFile "test079.juvix")
@ -873,6 +953,7 @@ allTests =
$ checkOutput [[nock| "Juvix! ✨ héllo world ✨" |]], $ checkOutput [[nock| "Juvix! ✨ héllo world ✨" |]],
mkAnomaTest mkAnomaTest
80 80
AnomaTestModeFull
"Maybe" "Maybe"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test080.juvix") $(mkRelFile "test080.juvix")
@ -885,6 +966,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
81 81
AnomaTestModeDebugOnly
"UInt8" "UInt8"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test081.juvix") $(mkRelFile "test081.juvix")
@ -904,6 +986,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
82 82
AnomaTestModeFull
"ByteArray" "ByteArray"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test082.juvix") $(mkRelFile "test082.juvix")
@ -922,6 +1005,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
83 83
AnomaTestModeFull
"Anoma ByteArray" "Anoma ByteArray"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test083.juvix") $(mkRelFile "test083.juvix")
@ -935,6 +1019,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
84 84
AnomaTestModeDebugOnly
"Anoma Sha256" "Anoma Sha256"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test084.juvix") $(mkRelFile "test084.juvix")
@ -942,13 +1027,14 @@ allTests =
$ checkOutput $ checkOutput
[ [nock| 64 |], [ [nock| 64 |],
[nock| [nock|
[ [
64 64
5092006196359674779938793937035252249221936503860319648757996882954518215195609232852607160812968472040491493412050369557521935588220586883008001462395444 5092006196359674779938793937035252249221936503860319648757996882954518215195609232852607160812968472040491493412050369557521935588220586883008001462395444
] |] ] |]
], ],
mkAnomaTest mkAnomaTest
85 85
AnomaTestModeFull
"Anoma Resource Machine builtins" "Anoma Resource Machine builtins"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test085.juvix") $(mkRelFile "test085.juvix")
@ -962,6 +1048,7 @@ allTests =
], ],
mkAnomaTest mkAnomaTest
86 86
AnomaTestModeDebugOnly
"Anoma Random" "Anoma Random"
$(mkRelDir ".") $(mkRelDir ".")
$(mkRelFile "test086.juvix") $(mkRelFile "test086.juvix")

View File

@ -40,7 +40,6 @@ mkNockmaAssertion Test {..} = do
. runError @(NockEvalError Natural) . runError @(NockEvalError Natural)
. runReader @(Storage Natural) _testProgramStorage . runReader @(Storage Natural) _testProgramStorage
$ eval _testProgramSubject _testProgramFormula $ eval _testProgramSubject _testProgramFormula
case evalResult of case evalResult of
Left natErr -> assertFailure ("Evaluation error: " <> show natErr) Left natErr -> assertFailure ("Evaluation error: " <> show natErr)
Right r -> case _testAssertEvalError of Right r -> case _testAssertEvalError of