generated from stacks-network/.github
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in as-max-len?
#300
Labels
bug
Something isn't working
Comments
Experimenting with this a bit more, it seems to be an off by one error. If the length passed to |
#[test]
fn as_max_len_string_utf8() {
crosscheck(
r#"(as-max-len? u"hello" u16)"#,
Ok(Some(
Value::some(
Value::string_utf8_from_string_utf8_literal("hello".to_owned()).unwrap(),
)
.unwrap(),
)),
);
}
#[test]
fn as_max_len_list() {
crosscheck(
r#"(as-max-len? (list 42 21) u2)"#,
Ok(Some(
Value::some(
Value::cons_list_unsanitized(vec![Value::Int(42), Value::Int(21)]).unwrap(),
)
.unwrap(),
)),
);
}
#[test]
fn as_max_len_string_0() {
crosscheck(
r#"(as-max-len? "" u0)"#,
Ok(Some(
Value::some(Value::string_ascii_from_bytes(vec![]).unwrap()).unwrap(),
)),
);
}
#[test]
fn as_max_len_list_0() {
crosscheck(
r#"(as-max-len? (list) u0)"#,
Ok(Some(
Value::some(Value::cons_list_unsanitized(vec![]).unwrap()).unwrap(),
)),
);
} |
Fixed in #306 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is returning
none
but it should return(some "")
. This seems to be a generic issue withas-max-len?
.The text was updated successfully, but these errors were encountered: