use std::collections::HashMap;
use unity_random::Random;
#[test]
fn rotation_uniform() {
let mut random = Random::new();
let mut map: HashMap<i32, [(f32, f32, f32, f32); 5]> = HashMap::new();
map.insert(
0,
[
(-0.3852562, 0.6600888, -0.572001, 0.297784),
(0.8236853, 0.2967314, -0.3907058, 0.2843273),
(-0.009309499, 0.8077586, 0.5777131, 0.116992),
(-0.2536207, -0.2656668, -0.7104853, 0.6002569),
(-0.8453134, -0.1006417, -0.5026407, 0.150562),
],
);
map.insert(
1,
[
(-0.9882466, -0.1518338, -0.01611338, 0.00746107),
(0.3793908, -0.5626, 0.7170578, 0.1592856),
(0.7265565, -0.6216908, 0.2923282, 0.01266633),
(-0.7304445, -0.1502138, 0.5862163, 0.3166024),
(-0.5770743, 0.3564141, 0.1778056, 0.7129793),
],
);
map.insert(
358118,
[
(-0.6524041, 0.4884959, 0.2634168, 0.5160931),
(0.2152063, 0.7392758, 0.6357824, 0.0542063),
(-0.2410408, 0.6661072, 0.5022157, 0.4959637),
(0.042864, -0.09325368, 0.9823352, 0.1564737),
(-0.3173761, 0.1035114, 0.7892614, 0.5153875),
],
);
map.insert(
30029247,
[
(0.04174484, -0.6379867, 0.4867128, 0.5952655),
(0.3968087, -0.411561, 0.7214289, 0.3907695),
(-0.8099886, -0.006126916, 0.5273947, 0.25639),
(-0.285549, -0.0779797, 0.4768292, 0.8276562),
(0.6148463, 0.6109422, -0.4468336, 0.2214803),
],
);
map.insert(
719188662,
[
(-0.4896397, 0.1808263, 0.228898, 0.8216815),
(0.2193511, -0.09431711, 0.9477759, 0.2114479),
(0.4818019, -0.6492331, 0.07347871, 0.5839214),
(0.6402159, -0.3533405, -0.3057681, 0.6097376),
(0.107194, 0.1872564, -0.4961351, 0.8410079),
],
);
for (seed, values) in map {
random.init_state(seed);
for rotation in values {
let result = random.rotation_uniform();
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);
}
}
}