mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
add some float operations with filesize (#6618)
* add some float operations with filesize * more changes * update return values on filesize-filesize, duration-duration * missed filesize in floordiv * missed float * duration
This commit is contained in:
@ -282,6 +282,66 @@ fn modulo() {
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_multiplication_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1mb * 2
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "1.9 MiB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_multiplication_float_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1mb * 1.2
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "1.1 MiB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_float_floor_division_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1mb // 3.0
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "325.5 KiB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_division_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1mb / 4
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "244.1 KiB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_float_division_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1mb / 3.1
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "315.0 KiB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_math() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user