use std::collections::HashMap; use unity_random::Random; #[test] fn rotation() { let mut random = Random::new(); let mut map: HashMap = HashMap::new(); map.insert( 0, [ (0.2477755, 0.247607, 0.5112399, 0.7848133), (-0.6736925, 0.5178836, 0.5271574, 0.006337939), (-0.3723219, -0.622979, 0.6461744, 0.2360765), (-0.5021738, -0.6009098, -0.4552309, 0.4236671), (-0.09917793, -0.4982792, -0.8543853, 0.1091213), ], ); map.insert( 1, [ (-0.8337072, -0.4575983, -0.3019655, 0.06597752), (-0.1505792, -0.4541412, -0.6607996, 0.5782954), (0.58749, -0.1356024, -0.6821509, 0.4136879), (-0.06008163, -0.5083565, 0.6933883, 0.5071258), (-0.5280357, -0.4565832, 0.4013278, 0.5929975), ], ); map.insert( 358118, [ (0.2816034, -0.6039599, 0.7284214, 0.1591673), (-0.6606192, -0.3827029, -0.002613061, 0.6458436), (-0.4764669, 0.6235631, 0.5496244, 0.2864635), (0.7240978, -0.3723812, 0.2943142, 0.5003936), (-0.5147247, -0.3834334, 0.5826655, 0.4985361), ], ); map.insert( 30029247, [ (0.2086227, -0.02378021, -0.893931, 0.3959779), (0.7435333, 0.336431, -0.3071671, 0.4895108), (0.4597569, -0.5887715, -0.2963573, 0.5951002), (-0.5447484, 0.2720788, -0.3831895, 0.6945416), (0.3738734, -0.88937, -0.2418565, 0.103659), ], ); map.insert( 719188662, [ (0.3067031, 0.4128429, -0.6156307, 0.5970702), (0.5497335, 0.3757691, -0.2684396, 0.6960825), (0.04327904, -0.07543653, -0.3687262, 0.9254605), (-0.8754873, -0.1597628, 0.1637789, 0.4256457), (0.4319072, 0.6592817, -0.4366314, 0.4337706), ], ); for (seed, values) in map { random.init_state(seed); for rotation in values { let result = random.rotation(); assert!((rotation.0 - result.0).abs() < f32::EPSILON); assert!((rotation.1 - result.1).abs() < f32::EPSILON); assert!((rotation.2 - result.2).abs() < f32::EPSILON); assert!((rotation.3 - result.3).abs() < f32::EPSILON); } } }