Add new acceptance test scenario (016)
``` Error: × Main thread panicked. ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/project/src/lib.rs:616:36 ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "test_slice", unique: Unique(7) }) ```
This commit is contained in:
parent
febe6345eb
commit
00b800c456
|
@ -0,0 +1,2 @@
|
|||
name = "acceptance_test_016"
|
||||
version = "0.0.0"
|
|
@ -0,0 +1,19 @@
|
|||
use aiken/builtin
|
||||
|
||||
pub fn slice(bytes: ByteArray, start: Int, end: Int) -> ByteArray {
|
||||
builtin.slice_bytearray(start, end, bytes)
|
||||
}
|
||||
|
||||
pub fn length(bytes: ByteArray) -> Int {
|
||||
builtin.length_of_bytearray(bytes)
|
||||
}
|
||||
|
||||
pub fn drop(bytes: ByteArray, n: Int) -> ByteArray {
|
||||
slice(bytes, n, length(bytes) - n)
|
||||
}
|
||||
|
||||
test drop_1() {
|
||||
let x = #[1, 2, 3, 4, 5, 6, 7]
|
||||
drop(x, 2) == #[3, 4, 5, 6, 7]
|
||||
}
|
||||
|
Loading…
Reference in New Issue