diff options
| author | bors <bors@rust-lang.org> | 2015-03-01 08:59:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-03-01 08:59:29 +0000 |
| commit | 0eb0ba38d0893f711e68321d3e6fe28a929cd00e (patch) | |
| tree | f352105235425f677a950f1c88bd5391da0f9721 /src/libcoretest | |
| parent | 0905c8a5ec856a6b972fcb239df2b8f6e82d2418 (diff) | |
| parent | 1c4fb909ffad8328983d893f2fefdb17215f2b21 (diff) | |
| download | rust-0eb0ba38d0893f711e68321d3e6fe28a929cd00e.tar.gz rust-0eb0ba38d0893f711e68321d3e6fe28a929cd00e.zip | |
Auto merge of #22087 - GuillaumeGomez:int-pow, r=alexcrichton
Fixes issue #22016
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/num/int_macros.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index f5657d939b2..c33729876cc 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -201,6 +201,17 @@ mod tests { assert_eq!(FromStrRadix::from_str_radix("Z", 35).ok(), None::<$T>); assert_eq!(FromStrRadix::from_str_radix("-9", 2).ok(), None::<$T>); } + + #[test] + fn test_pow() { + let mut r = 2 as $T; + + assert_eq!(r.pow(2u32), 4 as $T); + assert_eq!(r.pow(0u32), 1 as $T); + r = -2 as $T; + assert_eq!(r.pow(2u32), 4 as $T); + assert_eq!(r.pow(3u32), -8 as $T); + } } )} |
