Skip to content

Commit

Permalink
Add Turing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielledeleo authored and alecthomas committed Feb 4, 2019
1 parent 243dad6 commit f4dea84
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lexers/testdata/turing.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var x : int := 10

fcn testFunction(a, b, c)
result (a + b) * c
end testFunction

put testFunction(x, 2 * x, 3)
61 changes: 61 additions & 0 deletions lexers/testdata/turing.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"x"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":":"},
{"type":"Text","value":" "},
{"type":"KeywordType","value":"int"},
{"type":"Text","value":" "},
{"type":"Operator","value":":="},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"10"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordDeclaration","value":"fcn"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"testFunction"},
{"type":"Punctuation","value":"("},
{"type":"NameOther","value":"a"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"NameOther","value":"b"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"NameOther","value":"c"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":"\n "},
{"type":"Keyword","value":"result"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"("},
{"type":"NameOther","value":"a"},
{"type":"Text","value":" "},
{"type":"Operator","value":"+"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"b"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Operator","value":"*"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"c"},
{"type":"Text","value":"\n"},
{"type":"KeywordDeclaration","value":"end"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"testFunction"},
{"type":"Text","value":"\n\n"},
{"type":"Keyword","value":"put"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"testFunction"},
{"type":"Punctuation","value":"("},
{"type":"NameOther","value":"x"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Text","value":" "},
{"type":"Operator","value":"*"},
{"type":"Text","value":" "},
{"type":"NameOther","value":"x"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"3"},
{"type":"Punctuation","value":")"}
]

0 comments on commit f4dea84

Please sign in to comment.