Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #103 from Chia-Network/20221217-assign
Browse files Browse the repository at this point in the history
20221217 assign
  • Loading branch information
prozacchiwawa committed Aug 16, 2023
2 parents ceb24c8 + b07a31f commit 62eaade
Show file tree
Hide file tree
Showing 19 changed files with 1,589 additions and 109 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ jobs:
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: cargo test --no-default-features

- name: Exhaustive assign tests
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: cargo test -- --include-ignored assign

- name: Check coverage
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: |
Expand Down
2 changes: 1 addition & 1 deletion resources/coverage/run_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def collect_coverage():
required_percentage = int(args.require_percent)
has_required_pct = True

for file in result:
for file in filter(lambda f: '/tests/' not in f['name'], result):
have_pct = int(file['coveragePercent'])
if have_pct < required_percentage:
print(f"{file['name']} lacks required coverage have {have_pct} want {required_percentage}")
Expand Down
39 changes: 39 additions & 0 deletions resources/tests/chia-gaming/last.clinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(
(defun last_inner ((next . remainder))
(if remainder
(last_inner remainder)
next
)
)

(defmacro last ARGS
(defun snoc (L agg)
(if L
(if (r L)
(snoc (r L) (c (f L) agg))
(c (f L) agg)
)
(c () ())
)
)

(defun prefix (L P)
(if L
(c (f L) (prefix (r L) P))
P
)
)

(if ARGS
(if (r ARGS)
(assign
(final . rest) (snoc ARGS ())
reversed (prefix rest (list final))
(qq (last_inner (unquote (c list reversed))))
)
(qq (last_inner (unquote (f ARGS))))
)
(x "Last takes at least one argument")
)
)
)
6 changes: 6 additions & 0 deletions resources/tests/chia-gaming/test-last.clsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(mod ()
(include *standard-cl-21*)
(include last.clinc)

(last 99 100 101)
)
Loading

0 comments on commit 62eaade

Please sign in to comment.