diff options
-rw-r--r-- | .github/workflows/ci.yml | 18 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | bruijn.cabal | 2 | ||||
-rw-r--r-- | std/Float.bruijn | 6 | ||||
-rwxr-xr-x | std/test_all.sh | 16 |
5 files changed, 40 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..60181eb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: Test standard library + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: freckle/stack-action@v5 + - name: Run tests + run: cd std/ && ./test_all.sh @@ -1,2 +1,3 @@ .stack-work/ -*~
\ No newline at end of file +*~ +std/All.bruijn diff --git a/bruijn.cabal b/bruijn.cabal index 0e16f9d..fd81e7a 100644 --- a/bruijn.cabal +++ b/bruijn.cabal @@ -22,7 +22,6 @@ data-files: std/Char.bruijn std/Combinator.bruijn std/Float.bruijn - std/gen_all.sh std/List.bruijn std/Logic.bruijn std/Math.bruijn @@ -34,6 +33,7 @@ data-files: std/Result.bruijn std/Set.bruijn std/String.bruijn + std/test_all.sh std/AIT/Beavers.bruijn std/Number/Binary.bruijn std/Number/Conversion.bruijn diff --git a/std/Float.bruijn b/std/Float.bruijn index d2ed080..c272d2b 100644 --- a/std/Float.bruijn +++ b/std/Float.bruijn @@ -6,14 +6,14 @@ :import std/Combinator . :import std/Number . -:import std/Pair P +:import std/Pair . pi (+3) : (+14159) # generates a float from a normal balanced ternary number -float! \(P.…:…) (+0) +float! \…:… (+0) # adds two floating numbers # TODO: Carry support # - needed: mod, div (?) -> ternary carry != decimal carry -add P.zip-with …+… +add zip-with …+… diff --git a/std/test_all.sh b/std/test_all.sh new file mode 100755 index 0000000..8b0740a --- /dev/null +++ b/std/test_all.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +echo "# useful for running all tests of the standard library" >All.bruijn +echo >>All.bruijn + +FILES="$(find * -type f -name "*.bruijn" ! -name "All.bruijn")" + +for f in $FILES; do + echo ":import std/${f%*.bruijn} ." >>All.bruijn +done + +# for ci, just run `bruijn All.bruijn` +echo >>All.bruijn +echo "main [[0]]" >>All.bruijn + +stack run -- All.bruijn | grep "ERROR" && exit 1 || exit 0 |