Sha256: cf4eaf2171344d28e103f2425924a5baac21c3de2ffb950d8babb73f8d98b9ef
Contents?: true
Size: 1.25 KB
Versions: 42
Compression:
Stored size: 1.25 KB
Contents
extern crate perfect_numbers; use perfect_numbers::{Classification, classify}; macro_rules! tests { ($property_test_func:ident { $( $(#[$attr:meta])* $test_name:ident( $( $param:expr ),* ); )+ }) => { $( $(#[$attr])* #[test] fn $test_name() { $property_test_func($( $param ),* ) } )+ } } fn test_classification(num: u64, result: Classification) { assert_eq!(classify(num), Ok(result)); } #[test] fn basic() { assert_eq!(classify(0), Err("Number must be positive")); } tests! { test_classification { #[ignore] test_1(1, Classification::Deficient); #[ignore] test_2(2, Classification::Deficient); #[ignore] test_4(4, Classification::Deficient); #[ignore] test_6(6, Classification::Perfect); #[ignore] test_12(12, Classification::Abundant); #[ignore] test_28(28, Classification::Perfect); #[ignore] test_30(30, Classification::Abundant); #[ignore] test_32(32, Classification::Deficient); #[ignore] test_33550335(33550335, Classification::Abundant); #[ignore] test_33550336(33550336, Classification::Perfect); #[ignore] test_33550337(33550337, Classification::Deficient); } }
Version data entries
42 entries across 42 versions & 1 rubygems