2020-01-29 14:34:36 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn calculates_two_plus_two() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "2 + 2" | calc
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert!(actual.out.contains("4.0"));
|
2020-01-29 14:34:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn calculates_two_to_the_power_six() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "2 ^ 6" | calc
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert!(actual.out.contains("64.0"));
|
2020-01-29 14:34:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn calculates_three_multiplied_by_five() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "3 * 5" | calc
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert!(actual.out.contains("15.0"));
|
2020-01-29 14:34:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn calculates_twenty_four_divided_by_two() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
echo "24 / 2" | calc
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert!(actual.out.contains("12.0"));
|
2020-01-29 14:34:36 +01:00
|
|
|
}
|