-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
234 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Haskell CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-haskell@v1 | ||
with: | ||
ghc-version: '8.6.4' | ||
cabal-version: '3.0' | ||
- name: Install dependencies | ||
run: | | ||
cabal update | ||
cabal install --only-dependencies | ||
- name: Build | ||
run: | | ||
cabal configure | ||
cabal build | ||
- name: Run tests | ||
run: cabal test --test-show-details=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,6 @@ tests: | |
- -with-rtsopts=-N | ||
dependencies: | ||
- Harper | ||
- HUnit | ||
- test-framework | ||
- test-framework-hunit |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,78 @@ | ||
import Test.Framework | ||
import Test.Framework.Providers.HUnit | ||
import Test.HUnit | ||
|
||
import Harper.Lexer | ||
import Harper.Parser | ||
import Harper.Engine | ||
import Harper.Engine.Object | ||
import ErrM | ||
|
||
data TestProgram = TProg String Object | ||
|
||
lexer = myLexer | ||
parser = pProgram | ||
|
||
issue1_sqr = TProg "\ | ||
\sqr n = n * n;\n\ | ||
\main = sqr 42;" | ||
(PInt 1764) | ||
|
||
issue1_partial = TProg "\ | ||
\f a b c d = (c ^ d / a) * 123 + b;\n\ | ||
\fun n = f n;\n\ | ||
\main = (fun 2) 420 6 4;" | ||
(PInt 80124) | ||
|
||
issue1_string = TProg "\ | ||
\main = \"abcd\";" | ||
(PStr "abcd") | ||
|
||
issue1_bool1 = TProg "\ | ||
\f n = 2 * n;\n\ | ||
\main = (f 42 == 84) and (f 2 <= f 4) and (f 2 < f 5) and (true and not false);" | ||
(PBool True) | ||
|
||
issue1_bool2 = TProg "\ | ||
\main = true or false;" | ||
(PBool True) | ||
|
||
issue1_bool3 = TProg "\ | ||
\main = true and false;" | ||
(PBool False) | ||
|
||
issue1_mod = TProg "\ | ||
\f n = 2 * n;\n\ | ||
\main = f 5 mod 3 == 1 and f 5 mod 3 != 2 and f 5 mod 3 > 0 and f 5 mod 3 >= 1;" | ||
(PBool True) | ||
|
||
issue1_lazy = TProg "\ | ||
\fun n = fun (n + 1);\n\ | ||
\main = true or (fun 42);" | ||
(PBool True) | ||
|
||
testProg :: TestProgram -> Test.HUnit.Test | ||
testProg (TProg i o) = TestCase (assertEqual "Expected output" o run) | ||
where run = let ts = lexer i | ||
in case parser ts of | ||
Bad e -> error e | ||
Ok t -> fst $ runInterpreter t | ||
|
||
tests = TestList [TestLabel "issue1_sqr" (testProg issue1_sqr), | ||
TestLabel "issue1_partial" (testProg issue1_partial), | ||
TestLabel "issue1_string" (testProg issue1_string), | ||
TestLabel "issue1_bool1" (testProg issue1_bool1), | ||
TestLabel "issue1_bool2" (testProg issue1_bool2), | ||
TestLabel "issue1_bool3" (testProg issue1_bool3), | ||
TestLabel "issue1_mod" (testProg issue1_mod), | ||
TestLabel "issue1_lazy" (testProg issue1_lazy) | ||
] | ||
|
||
main :: IO () | ||
main = putStrLn "Test suite not yet implemented" | ||
main = defaultMain $ hUnitTestToTests tests |
Binary file not shown.