forked from extern/nushell
.azureold
.cargo
.github
crates
nu-ansi-term
nu-cli
nu-color-config
nu-command
assets
src
tests
commands
hash_
keep
math
avg.rs
eval.rs
median.rs
mod.rs
round.rs
sqrt.rs
sum.rs
move_
path
random
skip
str_
all.rs
any.rs
append.rs
cal.rs
cd.rs
compact.rs
cp.rs
def.rs
default.rs
drop.rs
each.rs
echo.rs
empty.rs
enter.rs
every.rs
find.rs
first.rs
flatten.rs
format.rs
get.rs
group_by.rs
headers.rs
help.rs
histogram.rs
into_filesize.rs
into_int.rs
last.rs
length.rs
lines.rs
ls.rs
merge.rs
mkdir.rs
mod.rs
open.rs
parse.rs
prepend.rs
range.rs
reduce.rs
reject.rs
rename.rs
reverse.rs
rm.rs
roll.rs
rotate.rs
save.rs
select.rs
semicolon.rs
sort_by.rs
source.rs
split_by.rs
split_column.rs
split_row.rs
touch.rs
uniq.rs
update.rs
where_.rs
which.rs
with_env.rs
wrap.rs
zip.rs
format_conversions
main.rs
Cargo.toml
build.rs
nu-engine
nu-json
nu-parser
nu-path
nu-plugin
nu-pretty-hex
nu-protocol
nu-system
nu-table
nu-term-grid
nu-test-support
nu_plugin_chart
nu_plugin_example
nu_plugin_from_bson
nu_plugin_from_mp4
nu_plugin_from_sqlite
nu_plugin_gstat
nu_plugin_inc
nu_plugin_match
nu_plugin_python
nu_plugin_query
nu_plugin_s3
nu_plugin_start
nu_plugin_to_bson
nu_plugin_to_sqlite
nu_plugin_tree
README.md
docs
images
pkg_mgrs
samples
src
tests
wix
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
Cargo.toml.old
LICENSE
Makefile.toml
README.build.txt
README.md
extra_features_cargo_install.sh
rustfmt.toml
32 lines
523 B
Rust
32 lines
523 B
Rust
use nu_test_support::nu;
|
|
|
|
#[test]
|
|
fn can_sqrt_numbers() {
|
|
let actual = nu!(
|
|
cwd: ".",
|
|
"echo [0.25 2 4] | math sqrt | math sum"
|
|
);
|
|
|
|
assert_eq!(actual.out, "3.914213562373095");
|
|
}
|
|
|
|
#[test]
|
|
fn can_sqrt_irrational() {
|
|
let actual = nu!(
|
|
cwd: ".",
|
|
"echo 2 | math sqrt"
|
|
);
|
|
|
|
assert_eq!(actual.out, "1.4142135623730951");
|
|
}
|
|
|
|
#[test]
|
|
fn can_sqrt_perfect_square() {
|
|
let actual = nu!(
|
|
cwd: ".",
|
|
"echo 4 | math sqrt"
|
|
);
|
|
|
|
assert_eq!(actual.out, "2");
|
|
}
|