Skip to content

Commit

Permalink
chore: add array and slice control flow tests (#5558)
Browse files Browse the repository at this point in the history
# Description

TODO
- [x] Make note to finish slice test after `pop_front` issue:
#5462
- [x] Refactor `any::<T>()`
- [x] Make issues for failing tests

## Problem\*

Part of #5362

## Summary\*

Simple combinator-based parsing tests for control flow.
- Originally designed for slices, but adapted to arrays by emulating
slices as bounded vectors

```rust
struct Bvec<T, let N: u32> {
    inner: [T; N],

    // elements at indices < offset are zero
    offset: u32, 

    // elements at indices >= len are zero
    len: u32,
}
```

## Additional Context

This code is hacky, but let me know if any parts are worth cleaning up
for the stdlib, e.g. `reverse_array`.

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: jfecher <[email protected]>
  • Loading branch information
michaeljklein and jfecher authored Jul 25, 2024
1 parent c02a6f6 commit d048e82
Show file tree
Hide file tree
Showing 2 changed files with 818 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test_programs/execution_success/slice_regex/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "regex"
type = "bin"
authors = [""]
compiler_version = ">=0.31.0"

[dependencies]
Loading

0 comments on commit d048e82

Please sign in to comment.