diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..761c02e --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,25 @@ + +name: Test anoma-apps + +on: + push: + branches: [ main ] + pull_request: + workflow_dispatch: + +jobs: + test: + name: Run test suite + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v3 + + - name: Download latest nightly Juvix binary + uses: jaxxstorm/action-install-gh-release@v1.10.0 + with: + repo: anoma/juvix-nightly-builds + cache: enable + + - name: Run tests + run: juvix eval tests/Main.juvix diff --git a/SimpleCounter/Package.juvix b/SimpleCounter/Package.juvix index c84d8b1..072be18 100644 --- a/SimpleCounter/Package.juvix +++ b/SimpleCounter/Package.juvix @@ -6,8 +6,5 @@ package : Package := defaultPackage {name := "simplecounter"; dependencies := [ defaultStdlib - ; github - "anoma" - "juvix-anoma-stdlib" - "b91e93a7582a7ac87e7756e39c28affc05926dca" + ; github "anoma" "juvix-anoma-stdlib" "v0.1.0" ]}; diff --git a/SimpleCounter/juvix.lock.yaml b/SimpleCounter/juvix.lock.yaml index 1418de8..6837b37 100644 --- a/SimpleCounter/juvix.lock.yaml +++ b/SimpleCounter/juvix.lock.yaml @@ -1,15 +1,18 @@ -# This file was autogenerated by Juvix version 0.6.2. +# This file was autogenerated by Juvix version 0.6.3. # Do not edit this file manually. version: 2 -checksum: 3de3e44074cdb117abc190a223acabe27623e099f7d782ab3722b4032ab0a8dd +checksum: d4d7643f2d4d193af44a11088b92b852ae2fdc14d3be8b071aa8f1158f83c340 dependencies: - path: .juvix-build/stdlib/ dependencies: [] - git: name: anoma_juvix-anoma-stdlib - ref: b91e93a7582a7ac87e7756e39c28affc05926dca + ref: 835ce837e75c35319ab7e362953f23f1bc5fd3e5 url: https://github.com/anoma/juvix-anoma-stdlib dependencies: - - path: .juvix-build/stdlib/ + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib dependencies: [] diff --git a/SimpleCounter/tests/Package.juvix b/SimpleCounter/tests/Package.juvix new file mode 100644 index 0000000..21058c6 --- /dev/null +++ b/SimpleCounter/tests/Package.juvix @@ -0,0 +1,14 @@ +module Package; + +import PackageDescription.V2 open; + +package : Package := + defaultPackage@?{ + name := "simplecounter-tests"; + dependencies := + [ defaultStdlib + ; github "anoma" "juvix-anoma-test" "v0.1.1" + ; github "anoma" "juvix-test" "v0.11.0" + ; path "../" + ] + }; diff --git a/SimpleCounter/tests/SimpleCounterTests.juvix b/SimpleCounter/tests/SimpleCounterTests.juvix new file mode 100644 index 0000000..11dff9e --- /dev/null +++ b/SimpleCounter/tests/SimpleCounterTests.juvix @@ -0,0 +1,23 @@ +module SimpleCounterTests; + +import Stdlib.Prelude open; +import Test.Anoma open; +import Test.JuvixUnit open; +import SimpleCounter open; + +tests : List Test := + [ testCase + "init counter with zeroedCounter is valid" + (anomaAssertPass (verify (init zeroedCounter))) + ; testCase + "init counter with incrementedCounter is invalid" + (anomaAssertFail (verify (init incrementedCounter))) + ; testCase + "update with zeroedCounter and incrementedCounter is valid" + (anomaAssertPass + (verify (update zeroedCounter incrementedCounter))) + ; testCase + "update with zeroedCounter and zeroedCounter is invalid" + (anomaAssertFail + (verify (update zeroedCounter zeroedCounter))) + ]; diff --git a/SimpleCounter/tests/juvix.lock.yaml b/SimpleCounter/tests/juvix.lock.yaml new file mode 100644 index 0000000..561c3ca --- /dev/null +++ b/SimpleCounter/tests/juvix.lock.yaml @@ -0,0 +1,72 @@ +# This file was autogenerated by Juvix version 0.6.3. +# Do not edit this file manually. + +version: 2 +checksum: bd05cf1a8cadb5c2486c0967a69d64e69e164fab40edb78d5d85e01875a9a8bd +dependencies: +- path: .juvix-build/stdlib/ + dependencies: [] +- git: + name: anoma_juvix-anoma-test + ref: f6a44eb714604bbaf923ebda31cdf4e7862d0186 + url: https://github.com/anoma/juvix-anoma-test + dependencies: + - git: + name: anoma_juvix-anoma-stdlib + ref: 835ce837e75c35319ab7e362953f23f1bc5fd3e5 + url: https://github.com/anoma/juvix-anoma-stdlib + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-containers + ref: c4c7af9bdf36aa9d2dbdc7e0372dd9278f60ff26 + url: https://github.com/anoma/juvix-containers + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-test + ref: 4254b60351f283f31868498d4e238af8259243f8 + url: https://github.com/anoma/juvix-test + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] +- git: + name: anoma_juvix-test + ref: 4254b60351f283f31868498d4e238af8259243f8 + url: https://github.com/anoma/juvix-test + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] +- path: ../ + dependencies: + - path: .juvix-build/stdlib/ + dependencies: [] + - git: + name: anoma_juvix-anoma-stdlib + ref: 835ce837e75c35319ab7e362953f23f1bc5fd3e5 + url: https://github.com/anoma/juvix-anoma-stdlib + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] diff --git a/tests/Main.juvix b/tests/Main.juvix new file mode 100644 index 0000000..c48ae74 --- /dev/null +++ b/tests/Main.juvix @@ -0,0 +1,9 @@ +module Main; + +import Stdlib.Prelude open; +import SimpleCounterTests; +import Test.JuvixUnit open; + +main : IO := + runTestSuite + (testSuite "SimpleCounter tests" SimpleCounterTests.tests); diff --git a/tests/Package.juvix b/tests/Package.juvix new file mode 100644 index 0000000..035b9aa --- /dev/null +++ b/tests/Package.juvix @@ -0,0 +1,12 @@ +module Package; + +import PackageDescription.V2 open; + +package : Package := + defaultPackage { + name := "anoma-apps-tests"; + dependencies := [ + defaultStdlib + ; github "anoma" "juvix-test" "v0.11.0" + ; path "../SimpleCounter/tests"] + }; diff --git a/tests/juvix.lock.yaml b/tests/juvix.lock.yaml new file mode 100644 index 0000000..7ef5ca7 --- /dev/null +++ b/tests/juvix.lock.yaml @@ -0,0 +1,86 @@ +# This file was autogenerated by Juvix version 0.6.3. +# Do not edit this file manually. + +version: 2 +checksum: d87fd331b8995c3c7132891e739e8ee59e768b9ba40d84de6c9fdf43e43fd33d +dependencies: +- path: .juvix-build/stdlib/ + dependencies: [] +- git: + name: anoma_juvix-test + ref: 4254b60351f283f31868498d4e238af8259243f8 + url: https://github.com/anoma/juvix-test + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] +- path: ../SimpleCounter/tests + dependencies: + - path: .juvix-build/stdlib/ + dependencies: [] + - git: + name: anoma_juvix-anoma-test + ref: f6a44eb714604bbaf923ebda31cdf4e7862d0186 + url: https://github.com/anoma/juvix-anoma-test + dependencies: + - git: + name: anoma_juvix-anoma-stdlib + ref: 835ce837e75c35319ab7e362953f23f1bc5fd3e5 + url: https://github.com/anoma/juvix-anoma-stdlib + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-containers + ref: c4c7af9bdf36aa9d2dbdc7e0372dd9278f60ff26 + url: https://github.com/anoma/juvix-containers + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-test + ref: 4254b60351f283f31868498d4e238af8259243f8 + url: https://github.com/anoma/juvix-test + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - git: + name: anoma_juvix-test + ref: 4254b60351f283f31868498d4e238af8259243f8 + url: https://github.com/anoma/juvix-test + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: [] + - path: ../ + dependencies: + - path: .juvix-build/stdlib/ + dependencies: [] + - git: + name: anoma_juvix-anoma-stdlib + ref: 835ce837e75c35319ab7e362953f23f1bc5fd3e5 + url: https://github.com/anoma/juvix-anoma-stdlib + dependencies: + - git: + name: anoma_juvix-stdlib + ref: 89a5960fb8a29291e9271986b98ca7b1edf4031b + url: https://github.com/anoma/juvix-stdlib + dependencies: []