1 // Copyright 2015 Brendan Zabarauskas 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //! Macro instantiation tests 16 17 #[macro_use] 18 extern crate approx; 19 20 #[test] 21 fn test_abs_diff_eq() { 22 let _: bool = abs_diff_eq!(1.0, 1.0); 23 let _: bool = abs_diff_eq!(1.0, 1.0, epsilon = 1.0); 24 } 25 26 #[test] 27 fn test_abs_diff_eq_trailing_commas() { 28 let _: bool = abs_diff_eq!(1.0, 1.0,); 29 let _: bool = abs_diff_eq!(1.0, 1.0, epsilon = 1.0,); 30 } 31 32 #[test] 33 fn test_abs_diff_ne() { 34 let _: bool = abs_diff_ne!(1.0, 1.0); 35 let _: bool = abs_diff_ne!(1.0, 1.0, epsilon = 1.0); 36 } 37 38 #[test] 39 fn test_abs_diff_ne_trailing_commas() { 40 let _: bool = abs_diff_ne!(1.0, 1.0,); 41 let _: bool = abs_diff_ne!(1.0, 1.0, epsilon = 1.0,); 42 } 43 44 #[test] 45 fn test_relative_eq() { 46 let _: bool = relative_eq!(1.0, 1.0); 47 let _: bool = relative_eq!(1.0, 1.0, epsilon = 1.0); 48 let _: bool = relative_eq!(1.0, 1.0, max_relative = 1.0); 49 let _: bool = relative_eq!(1.0, 1.0, epsilon = 1.0, max_relative = 1.0); 50 } 51 52 #[test] 53 fn test_relative_eq_trailing_commas() { 54 let _: bool = relative_eq!(1.0, 1.0,); 55 let _: bool = relative_eq!(1.0, 1.0, epsilon = 1.0, max_relative = 1.0,); 56 } 57 58 #[test] 59 fn test_relative_ne() { 60 let _: bool = relative_ne!(1.0, 1.0); 61 let _: bool = relative_ne!(1.0, 1.0, epsilon = 1.0); 62 let _: bool = relative_ne!(1.0, 1.0, max_relative = 1.0); 63 let _: bool = relative_ne!(1.0, 1.0, epsilon = 1.0, max_relative = 1.0); 64 } 65 66 #[test] 67 fn test_relative_ne_trailing_commas() { 68 let _: bool = relative_ne!(1.0, 1.0,); 69 let _: bool = relative_ne!(1.0, 1.0, epsilon = 1.0, max_relative = 1.0,); 70 } 71 72 #[test] 73 fn test_ulps_eq() { 74 let _: bool = ulps_eq!(1.0, 1.0); 75 let _: bool = ulps_eq!(1.0, 1.0, epsilon = 1.0); 76 let _: bool = ulps_eq!(1.0, 1.0, max_ulps = 1); 77 let _: bool = ulps_eq!(1.0, 1.0, epsilon = 1.0, max_ulps = 1); 78 } 79 80 #[test] 81 fn test_ulps_eq_trailing_commas() { 82 let _: bool = ulps_eq!(1.0, 1.0,); 83 let _: bool = ulps_eq!(1.0, 1.0, epsilon = 1.0, max_ulps = 1,); 84 } 85 86 #[test] 87 fn test_ulps_ne() { 88 let _: bool = ulps_ne!(1.0, 1.0); 89 let _: bool = ulps_ne!(1.0, 1.0, epsilon = 1.0); 90 let _: bool = ulps_ne!(1.0, 1.0, max_ulps = 1); 91 let _: bool = ulps_ne!(1.0, 1.0, epsilon = 1.0, max_ulps = 1); 92 } 93 94 #[test] 95 fn test_ulps_ne_trailing_commas() { 96 let _: bool = ulps_ne!(1.0, 1.0,); 97 let _: bool = ulps_ne!(1.0, 1.0, epsilon = 1.0, max_ulps = 1,); 98 } 99