From 9bb6325846269b3acb999a3a0b20b74511fa8611 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 8 Aug 2015 14:52:57 +0200 Subject: [PATCH] Made tests more readable --- tests/mat.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/tests/mat.rs b/tests/mat.rs index 28878b40..12fc7a0a 100644 --- a/tests/mat.rs +++ b/tests/mat.rs @@ -633,16 +633,13 @@ fn test_cholesky_const() { let result = na::cholesky(&a); - match result { - Ok(v) => { - assert!(na::approx_eq(&v, &g)); + assert!(result.is_ok()); - let recomp = v * na::transpose(&v); - assert!(na::approx_eq(&recomp, &a)); - }, + let v = result.unwrap(); + assert!(na::approx_eq(&v, &g)); - Err(_) => assert!(false), - } + let recomp = v * na::transpose(&v); + assert!(na::approx_eq(&recomp, &a)); } #[test] @@ -652,10 +649,7 @@ fn test_cholesky_not_spd() { let result = na::cholesky(&a); - match result { - Ok(_) => assert!(false), - Err(_) => assert!(true), - } + assert!(result.is_err()); } #[test] @@ -665,10 +659,7 @@ fn test_cholesky_not_symmetric() { let result = na::cholesky(&a); - match result { - Ok(_) => assert!(false), - Err(_) => assert!(true), - } + assert!(result.is_err()); } #[test]