num-complex
Advanced tools
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
+1
-1
@@ -10,3 +10,3 @@ [package] | ||
| repository = "https://github.com/rust-num/num" | ||
| version = "0.1.35" | ||
| version = "0.1.36" | ||
@@ -13,0 +13,0 @@ [dependencies] |
+19
-1
@@ -12,2 +12,6 @@ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT | ||
| //! Complex numbers. | ||
| #![doc(html_logo_url = "https://rust-num.github.io/num/rust-logo-128x128-blk-v2.png", | ||
| html_favicon_url = "https://rust-num.github.io/num/favicon.ico", | ||
| html_root_url = "https://rust-num.github.io/num/", | ||
| html_playground_url = "http://play.integer32.com/")] | ||
@@ -33,3 +37,3 @@ extern crate num_traits as traits; | ||
| /// A complex number in Cartesian form. | ||
| #[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] | ||
| #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug, Default)] | ||
| #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] | ||
@@ -1222,2 +1226,16 @@ pub struct Complex<T> { | ||
| #[test] | ||
| fn test_hashset() { | ||
| use std::collections::HashSet; | ||
| let a = Complex::new(0i32, 0i32); | ||
| let b = Complex::new(1i32, 0i32); | ||
| let c = Complex::new(0i32, 1i32); | ||
| let set: HashSet<_> = [a, b, c].iter().cloned().collect(); | ||
| assert!(set.contains(&a)); | ||
| assert!(set.contains(&b)); | ||
| assert!(set.contains(&c)); | ||
| assert!(!set.contains(&(a + b + c))); | ||
| } | ||
| #[test] | ||
| fn test_is_nan() { | ||
@@ -1224,0 +1242,0 @@ assert!(!_1_1i.is_nan()); |