Skip to content

Commit

Permalink
Merge pull request #327 from HigherOrderCO/test-suite
Browse files Browse the repository at this point in the history
add test suite
  • Loading branch information
VictorTaelin authored May 22, 2024
2 parents c9ce40c + b414c03 commit 656c881
Show file tree
Hide file tree
Showing 29 changed files with 558 additions and 51 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Checks

on:
pull_request:
merge_group:
push:
branches:
- main

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dsherret/rust-toolchain-file@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-check-${{ hashFiles('**/Cargo.lock') }}
- run: RUSTFLAGS="-D warnings" cargo check --all-targets
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dsherret/rust-toolchain-file@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
- run: cargo test --release
test-cuda:
needs: test # don't bother the cuda machine if other tests are failing
runs-on: [self-hosted, cuda]
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dsherret/rust-toolchain-file@v1
- run: cargo test --release
shell: bash -l {0}

197 changes: 196 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ default = []
# C and CUDA features are determined during build
c = []
cuda = []

[dev-dependencies]
insta = { version = "1.39.0", features = ["glob"] }
2 changes: 1 addition & 1 deletion examples/sort_bitonic/main.bend
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def sort(d, s, t):
return flow(d, s, (sort(d-1, 0, t.a), sort(d-1, 1, t.b)))

def main:
return sum(20, sort(20, 0, gen(20, 0)))
return sum(16, sort(16, 0, gen(16, 0)))
6 changes: 3 additions & 3 deletions examples/sort_bitonic/main.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
&! @gen ~ (d (e f))

@main = a
& @sum ~ (18 (@main__C1 a))
& @sum ~ (16 (@main__C1 a))

@main__C0 = a
& @gen ~ (18 (0 a))
& @gen ~ (16 (0 a))

@main__C1 = a
& @sort ~ (18 (0 (@main__C0 a)))
& @sort ~ (16 (0 (@main__C0 a)))

@sort = (?(((a (* a)) @sort__C0) (b (c d))) (c (b d)))

Expand Down
2 changes: 1 addition & 1 deletion examples/sort_radix/main.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@main = c
& @sum ~ (b c)
& @sort ~ (a b)
& @gen ~ (20 (0 a))
& @gen ~ (16 (0 a))

@merge = ((@merge$C5 (@merge$C3 (@merge$C2 a))) a)

Expand Down
2 changes: 1 addition & 1 deletion examples/stress/main.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
& @loop ~ a

@main = a
& @fun ~ (18 a)
& @fun ~ (10 a)
2 changes: 1 addition & 1 deletion examples/sum_rec/main.bend
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sum = λn λx switch n {
(+ fst snd)
}

main = (sum 30 0)
main = (sum 24 0)
4 changes: 2 additions & 2 deletions examples/sum_rec/main.hvm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@main = a
& @sum ~ (28 (0 a))
& @sum ~ (24 (0 a))

@sum = (?(((a a) @sum__C0) b) b)

@sum__C0 = ({c a} ({$([*2] $([+1] d)) $([*2] $([+0] b))} f))
&! @sum ~ (a (b $(:[+] $(e f))))
&! @sum ~ (a (b $([+] $(e f))))
&! @sum ~ (c (d e))
6 changes: 3 additions & 3 deletions examples/sum_tree/main.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
&!@gen ~ (d (e f))

@main = a
& @sum ~ (26 (@main__C0 a))
& @sum ~ (20 (@main__C0 a))

@main__C0 = a
& @gen ~ (26 (0 a))
& @gen ~ (20 (0 a))

@sum = (?(((* 1) @sum__C0) a) a)

@sum__C0 = ({a c} ((b d) f))
&!@sum ~ (a (b $(:[+] $(e f))))
&!@sum ~ (a (b $([+] $(e f))))
&!@sum ~ (c (d e))
Loading

0 comments on commit 656c881

Please sign in to comment.