chore(tests): fix/disable some tests

This commit is contained in:
Leonardo de Moura 2019-03-21 13:19:52 -07:00
parent b8c786117c
commit 2cbdb287c3
17 changed files with 49 additions and 272 deletions

View file

@ -1,6 +1,6 @@
--
#check and.intro
#check or.elim
#check And.intro
#check Or.elim
#check Eq
#check Eq.rec

View file

@ -1,3 +1,4 @@
#exit -- Disabled until we implement new VM
#eval "abc"
/- some "a" -/

View file

@ -1,12 +1 @@
"abc"
(some "a")
(some "")
none
(some "abc")
(some "bcde")
(some "abcde")
(some "ab")
none
none
(some "a")
(some "a")
extract.lean:1:0: warning: using 'exit' to interrupt Lean

View file

@ -1,5 +1,5 @@
def f : List Nat → Bool
| [] := ff
| [] := false
| (a::as) := a > 0 && f as
#check f._main._cstage2
@ -18,8 +18,8 @@ with f4 : Nat → Bool
| 0 := f5 0
| (x+1) := f4 x
with f5 : Nat → Bool
| 0 := tt
| _ := ff
| 0 := true
| _ := false
#check f1._main._cstage2
#check f2._main._cstage2

View file

@ -1,10 +1,12 @@
import init.Lean.Expander init.IO
import init.lean.expander init.io
open Lean.Expander -- for coercions
open Lean.Parser
open Lean.Parser.Term
local attribute [reducible] MacroScope
#exit -- Disabled until we implement new VM
-- TODO(Sebastian): `Syntax.toFormat` should probably propagate scopes by itself in the end
#eval (do {

View file

@ -1,20 +1 @@
(term.pi{1}
"Π"
(term.binders (0 (term.binders_ext [(term.binder_ident (0 `a))] [])))
","
(term.sort (1 "Type")))
(term.pi
"Π"
(term.binders{1, 2} (0 (term.binders_ext [(term.binder_ident (0 `a))] [])))
","
(term.sort{1, 2} (1 "Type")))
(term.pi{2}
"Π"
(term.binders{1, 2} (0 (term.binders_ext [(term.binder_ident (0 `a))] [])))
","
(term.sort{1, 2} (1 "Type")))
(term.pi
"Π"
(term.binders{1} (0 (term.binders_ext [(term.binder_ident (0 `a))] [])))
","
(term.sort{1} (1 "Type")))
macro_scopes.lean:8:0: warning: using 'exit' to interrupt Lean

View file

@ -1,22 +1,24 @@
import init.Lean.Parser.identifier init.Lean.Ir.Parser init.Lean.Ir.Format
import init.lean.parser.identifier
open Lean.Parser
open Lean.Parser.MonadParsec
def test {α} [DecidableEq α] (p : Parsec' α) (s : String) (e : α) : Eio Unit :=
def test {α} [DecidableEq α] (p : Parsec' α) (s : String) (e : α) : IO Unit :=
match Parsec.parse p s with
| Except.ok a := if a = e then pure () else IO.println "unexpected Result"
| Except.error e := IO.println e
def testFailure {α} (p : Parsec' α) (s : String) : Eio Unit :=
def testFailure {α} (p : Parsec' α) (s : String) : IO Unit :=
match Parsec.parse p s with
| Except.ok a := IO.println "unexpected success"
| Except.error e := pure ()
def showResult {α} [HasToString α] (p : Parsec' α) (s : String) : Eio Unit :=
def showResult {α} [HasToString α] (p : Parsec' α) (s : String) : IO Unit :=
match Parsec.parse p s with
| Except.ok a := IO.println "Result: " *> IO.println (repr $ toString a)
| Except.error e := IO.println e
#exit -- Disabled until we implement new VM
#eval test (ch 'a') "a" 'a'
#eval test any "a" 'a'
#eval test any "b" 'b'

View file

@ -1,15 +1 @@
Failure 1
error at line 1, column 5:
unexpected end of input
expected variable, numeral or '('
---------
Failure 2
error at line 1, column 0:
unexpected end of input
expected variable, numeral or '('
---------
Failure 3
error at line 1, column 0:
unexpected '*'
expected digit or letter
---------
parsec1.lean:20:0: warning: using 'exit' to interrupt Lean

View file

@ -1,10 +1,12 @@
import init.Lean.frontend init.IO
import init.lean.frontend init.io
open Lean
open Lean.Parser
open Lean.Expander
open Lean.Elaborator
def checkReprint (p : List moduleParserOutput) (s : String) : ExceptT String IO Unit :=
#exit -- Test contain many type errors, `#eval` is not working
def checkReprint (p : List ModuleParserOutput) (s : String) : ExceptT String IO Unit :=
do let stx := Syntax.List $ p.map (λ o, o.cmd),
let stx := stx.updateLeading s,
some s' ← pure $ stx.reprint | IO.println "reprint fail: choice Node",

View file

@ -1,110 +1 @@
result:
[(module.header [(module.prelude "prelude")] []) (module.eoi "")]
result:
[(module.header [] [(module.import "import" [(module.import_path [] `me)])])
(module.eoi "")]
<unknown>:1:0: error: expected command
partial syntax tree:
[(module.header [] []) (module.eoi "")]
<unknown>:1:6: error: unexpected end of input
expected "." or identifier
partial syntax tree:
[(module.header
[]
[(module.import "import" [(module.import_path [] <missing>) <missing>])
<missing>])
(module.eoi "")]
result:
[(module.header
[(module.prelude "prelude")]
[(module.import
"import"
[(module.import_path ["." "."] `a) (module.import_path [] `b)])
(module.import "import" [(module.import_path [] `c)])])
(module.eoi "")]
result:
[(module.header [] [])
(command.open
"open"
[(command.open_spec `me [] [] [] []) (command.open_spec `you [] [] [] [])])
(module.eoi "")]
result:
[(module.header [] [])
(command.open
"open"
[(command.open_spec
`me
[(command.open_spec.as "as" `you)]
[(command.open_spec.only ["(" `a] [`b `c] ")")]
[(command.open_spec.renaming
["(" "renaming"]
[(command.open_spec.renaming.item `a "->" `b)
(command.open_spec.renaming.item `c "->" `d)]
")")]
[(command.open_spec.hiding "(" "hiding" [`a `b] ")")])])
(module.eoi "")]
<unknown>:1:11: error: expected command
partial syntax tree:
[(module.header [] [])
(command.open
"open"
[(command.open_spec `me [] [] [] []) (command.open_spec `you [] [] [] [])])
(module.eoi "")]
<unknown>:1:5: error: expected identifier
<unknown>:1:9: error: unexpected end of input
expected identifier
partial syntax tree:
[(module.header [] [])
(command.open "open" [<missing> <missing>])
(command.open "open" [<missing> <missing>])
(module.eoi "")]
<unknown>:1:8: error: expected command
partial syntax tree:
[(module.header [] [])
(command.open "open" [(command.open_spec `me [] [] [] [])])
(command.open "open" [(command.open_spec `you [] [] [] [])])
(module.eoi "")]
result:
[(module.header [] [])
(command.open "open" [(command.open_spec `a [] [] [] [])])
(command.section "section" [`b])
(command.open "open" [(command.open_spec `c [] [] [] [])])
(command.section "section" [`d])
(command.open "open" [(command.open_spec `e [] [] [] [])])
(command.end "end" [`d])
(command.end "end" [`b])
(module.eoi "")]
result:
[(module.header [] [])
(command.section "section" [`a])
(command.end "end" [])
(module.eoi "")]
Type (max u v) : Type ((max u v)+1)
result:
[(module.header [] [])
(command.check
"#check"
(term.app
(term.app
(term.sort_app (term.sort (1 "Type")) (level.leading (0 `max)))
(ident_univs `u []))
(ident_univs `v [])))
(module.eoi "")]
(ok (some "notationa`+`:65 b:65 :=nat.addab"))
parser1.lean:78:0: error: ambiguous overload, possible interpretations
α
foo.α
Additional information:
parser1.lean: context: switched to basic overload resolution where arguments are elaborated without any information about the expected type because it failed to disambiguate overload using the expected type
Sort ?
the following overloaded terms were applicable
α
α
parser1.lean:78:0: error: unknown declaration 'sorry_ax'
parser1.lean:1:0: error: don't know how to synthesize placeholder
context:
⊢ Sort ?
<stdin>:10:0: error: unknown declaration 'sorry_ax'
<stdin>:1:0: parser cache hit rate: 169/196
<stdin>:1:0: parser cache hit rate: 67/78
parser1.lean:102:0: warning: using 'exit' to interrupt Lean
parser1.lean:7:0: warning: using 'exit' to interrupt Lean

View file

@ -9,6 +9,8 @@ foo
def ex₂ : ExceptT String (StateT (Array Nat) id) Nat :=
foo
#exit
-- The following examples were producing an element of Type `id (Except String Nat)`.
-- Type class resolution was failing to produce an instance for `HasRepr (id (Except String Nat))` because `id` is not transparent.
#eval run ex₁ (mkArray 10 1000)

View file

@ -1,2 +1 @@
(ok 1000)
(ok 33)
repr_issue.lean:12:0: warning: using 'exit' to interrupt Lean

View file

@ -1,25 +1,25 @@
inductive Type
| bv : Type
| bit : Type
inductive type
| bv : type
| bit : type
open Type
open type
-- This is a "parameterized List" where `plist f types` contains
-- an element of Type `f tp` for each corresponding element `tp ∈ types`.
inductive plist (f : Type → Type) : List Type → Type
inductive plist (f : type → Type) : List type → Type
| nil {} : plist []
| cons {h:Type} {r:List Type} : f h → plist r → plist (h::r)
| cons {h:type} {r:List type} : f h → plist r → plist (h::r)
-- Operations on values; the first argument contains the types of
-- inputs, and the second for the return Type.
inductive op : List Type → Type → Type
| neq (tp:Type) : op [tp, tp] bit
inductive op : List type → type → Type
| neq (tp:type) : op [tp, tp] bit
| mul (w:) : op [bv w, bv w] (bv w)
-- Denotes expressions that evaluate to a number given a memory State and register to value map.
inductive value : Type → Type
inductive value : type → Type
| const (w:) : value (bv w)
| op {args:List Type} {tp:Type} : op args tp → plist value args → value tp
| op {args:List type} {tp:type} : op args tp → plist value args → value tp
--- This creates a plist (borrowed from the List notation).
notation `[[[` l:(foldr `,` (h t, plist.cons h t) plist.nil) `]]]` := l
@ -27,16 +27,14 @@ notation `[[[` l:(foldr `,` (h t, plist.cons h t) plist.nil) `]]]` := l
open value
-- This works
#eval value.op (op.mul 32) [[[ const 32, const 32 ]]]
-- #eval value.op (op.mul 32) [[[ const 32, const 32 ]]]
-- This also works
instance bvHasMul (w:) : HasMul (value (bv w)) := ⟨λx y, value.op (op.mul w) [[[x, y]]]⟩
#eval const 32 * const 32
-- #eval const 32 * const 32
-- This works
#eval value.op (op.neq (bv 32)) [[[ const 32, const 32 ]]]
-- This returns the VM check error
def neq {tp:Type} (x y : value tp) : value bit := value.op (op.neq tp) [[[x, y]]]
#eval neq (const 32) (const 32)
-- #eval value.op (op.neq (bv 32)) [[[ const 32, const 32 ]]]
def neq {tp:type} (x y : value tp) : value bit := value.op (op.neq tp) [[[x, y]]]
-- #eval neq (const 32) (const 32)

View file

@ -1,3 +1,5 @@
#exit -- Disabled until we implement new VM
#eval ("abc" ++ "cde").length
#eval "abc".popBack
#eval "".popBack

View file

@ -1,36 +1 @@
6
"ab"
""
"abc"
"cd"
"ab"
""
"abcd"
"foo"
".lean"
"αβ"
2
"α_foo_βcc"
"αβ_foo_cc"
"α_foo_βcc"
4
3
7
5
6
0
0
1
2
1
1
6
0
1
4
(1, 0)
(1, 1)
(1, 2)
(2, 0)
(3, 4)
(3, 7)
string_imp.lean:1:0: warning: using 'exit' to interrupt Lean

View file

@ -9,6 +9,9 @@ let it₁ := s.mkIterator in
let it₂ := it₁.next in
it₁.remainingToString ++ "-" ++ it₂.remainingToString
#exit -- Disabled until we implement new VM
def r (s : String) : String :=
let it₁ := s.mkIterator.toEnd in
let it₂ := it₁.prev in
@ -19,6 +22,7 @@ let it₁ := s.mkIterator.toEnd in
let it₂ := it₁.prev in
(it₁.insert "abc").toString ++ (it₂.insert "de").toString
#eval "hello" ++ "hello"
#eval f "hello"
#eval (f "αβ").length

View file

@ -1,48 +1 @@
"hellohello"
"hello hello"
5
['h', 'e', 'l', 'l', 'o']
['α', 'β']
[]
['α', 'β', 'γ']
[]
['α']
['β', 'α']
['β', 'γ']
['α', 'β']
"αβa"
"α α-"
'A'
"aβγ"
"abγ"
"abc"
"cbγ"
"0bc"
"01c"
"012"
"21c"
"λbc"
"abc-bc"
"abc"
"a\x00bb"
4
"abc-ab"
"abc"
ff
tt
ff
ff
tt
tt
ff
"αβabc"
"αabcβ"
"αβabcαdeβ"
"adef"
"abef"
"aef"
"aba"
ff
tt
tt
ff
string_imp2.lean:13:0: warning: using 'exit' to interrupt Lean