1
0

Improve tests; Clean up

This commit is contained in:
Jeff 2024-01-29 23:57:13 -05:00
parent da11431edf
commit 7f30097d45
3 changed files with 35 additions and 11 deletions

View File

@ -1,11 +1,20 @@
cast = download("https://api.sampleapis.com/futurama/cast")
characters = download("https://api.sampleapis.com/futurama/characters")
episodes = download("https://api.sampleapis.com/futurama/episodes")
cast_len = 0
characters_len = 0
episodes_len = 0
async {
cast_len = length(from_json(cast))
characters_len = length(from_json(characters))
episodes_len = length(from_json(episodes))
{
cast = download("https://api.sampleapis.com/futurama/cast")
cast_len = length(from_json(cast))
}
{
characters = download("https://api.sampleapis.com/futurama/characters")
characters_len = length(from_json(characters))
}
{
episodes = download("https://api.sampleapis.com/futurama/episodes")
episodes_len = length(from_json(episodes))
}
}
output ([cast_len, characters_len, episodes_len])

View File

@ -1,3 +0,0 @@
handle = thread:spawn("my_thread", {
})

View File

@ -13,11 +13,29 @@ fn integer() {
assert_eq!(interpret("-666"), Ok(Value::Integer(-666)));
}
#[test]
fn integer_overflow() {
assert_eq!(
interpret("9223372036854775807 + 1"),
Ok(Value::Integer(i64::MIN))
);
assert_eq!(
interpret("-9223372036854775808 - 1"),
Ok(Value::Integer(i64::MAX))
);
}
#[test]
fn float() {
assert_eq!(interpret("0.1"), Ok(Value::Float(0.1)));
assert_eq!(interpret("12.3"), Ok(Value::Float(12.3)));
assert_eq!(interpret("-6.66"), Ok(Value::Float(-6.66)));
assert_eq!(
interpret("1.7976931348623157e308f64"),
Ok(Value::Float(f64::MAX))
);
assert_eq!(
interpret("-1.7976931348623157e308f64"),
Ok(Value::Float(f64::MIN))
);
}
#[test]