aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-13 18:29:10 -0400
committerGraydon Hoare <[email protected]>2011-03-14 15:52:48 -0700
commit922f69387dab9f751ab110055d5b9638dbae6a78 (patch)
tree699fef780ab5b74a092b9a0e009e683189771a15 /src/test
parentMention test/bench in README (diff)
downloadrust-922f69387dab9f751ab110055d5b9638dbae6a78.tar.xz
rust-922f69387dab9f751ab110055d5b9638dbae6a78.zip
Add _int.pow
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/lib-int.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/run-pass/lib-int.rs b/src/test/run-pass/lib-int.rs
index 153c3683..2e85abf6 100644
--- a/src/test/run-pass/lib-int.rs
+++ b/src/test/run-pass/lib-int.rs
@@ -11,6 +11,17 @@ fn test_to_str() {
check (eq(_int.to_str(100, 10u), "100"));
}
+fn test_pow() {
+ check (_int.pow(0, 0u) == 1);
+ check (_int.pow(0, 1u) == 0);
+ check (_int.pow(0, 2u) == 0);
+ check (_int.pow(-1, 0u) == -1);
+ check (_int.pow(1, 0u) == 1);
+ check (_int.pow(-3, 2u) == 9);
+ check (_int.pow(-3, 3u) == -27);
+ check (_int.pow(4, 9u) == 262144);
+}
+
fn main() {
test_to_str();
}