use squares_rnd::{KEY, Rand}; #[test] fn verify_u32() { let expected = [ 3352654702u32, 4074910648, 2177904447, 3591997784, 309172526, 14118540, 1376456388, 1817611776, 2658708129, 3816631332, 2074957304, 1197607180, 3382851809, 4630807, 969366713, 1214429827, 1551357583, 964614781, 885797288, 228455009, 3795099028, 2846967822, 860132314, 2417913545, 549388739, 1054086960, 3198953764, 1017529211, 4071162903, 1860614063, 976680366, 2474148318, 2555832691, 5746874, 2213997678, 4127664552, 1824987508, 2003555489, 669285426, 1956273251, 1331312278, 384168544, 767219735, 1703125500, 1151964577, 1451362376, 786830311, 3007546033, 1978998827, 3677699848, 1875248042, 3251648427, 2883285475, 1388411661, 3702855681, 1686575763, 3869385310, 1786705876, 1811588117, 1271892253, 3435479074, 2806725047, 1987296021, 4264790073, 3869965352, 1668365357, 1992522618, 2590424441, 2063541441, 1566680018, 3094852598, 3288611027, 2142634010, 2479402868, 775827867, 3363128138, 2433828005, 3871725313, 453889514, 2016441173, 404358135, 4200715467, 3466728357, 2124499209, 3091969433, 4224907557, 3597787665, 944831321, 247498744, 1409630787, 956022842, 913395360, 951808902, 1301972083, 335847163, 2543114637, 1852668585, 4090590393, 2745796757, 727871298, ]; let rand = Rand::new(KEY); for expected in expected.chunks(2) { assert_eq!(rand.next_u32(), expected[0]); let res = rand.next_full_u32(); assert!(res.counter % 2 != 0); //counter starts from 0 so always must be true assert_eq!(res.value, expected[1]); } } #[test] fn verify_u64() { let expected = [ 14399542303155484263u64, 17501607969359464034, 9354028374942533382, 15427513012393281532, 1327885891373351147, 60638670215810043, 5911835172535428600, 7806583138883068395, 11419064466034786357, 16392306754029120696, 8911873762093407361, 5143683672172701690, 14529237890604122752, 19889166102031785, 4163398334406911152, 5215936393198264659, 6663030086176828147, 4142988939815573669, 3804470384634822310, 981206793566959392, 16299826212061670494, 12227633688552008664, 3694240162244720062, 10384859601573002243, 2359606668987345604, 4527269021397652637, 13739401801815258063, 4370254686731437278, 17485511525953148642, 7991276553396556667, 4194810233081806530, 10626386112989138509, 10977217822832889495, 24682639439007289, 9509047622910815416, 17728184262025808435, 7838261665743942276, 8605205304630665208, 2874559017119030751, 8402129636376629661, 5717942698132331305, 1649991336016897064, 3295183672220509950, 7314868326649166118, 4947650188088540507, 6233553940330143969, 3379410454493317030, 12917311855428041199, 8499735244970525920, 15795600574330558527, 8054129013612082032, 13965723653650379501, 12383616822729305560, 5963182679409556272, 15903644052678103379, 7243787744618625032, 16618883363856591479, 7673843308844980174, 7780711718399524232, 5462735632226813910, 14755270269289560618, 12054792288415653926, 8535371421003719263, 18317133887998968270, 16621374626717847180, 7165574647168350039, 8557819483486794023, 11125788260570175986, 8862843003249831367, 6728839444092422614, 13292290694420989225, 14124476813394813502, 9202543002727219547, 10648954232663981208, 3332155316792614203, 14444525369156352631, 10453211686892771026, 16628933598458950702, 1949440621185508190, 8660548895303310226, 1736704969262069192, 18041935551059624115, 14889484920543723135, 9124654623922895816, 13279907595754884703, 18145839787438662779, 15452380362066314963, 4058019627408702579, 1062999014878645618, 6054318132808991276, 4106086844527938010, 3923003203613301236, 4087988107706547008, 5591927520822166873, 1442452585074274494, 10922594199957697924, 7957150986473910430, 17568951962841284160, 11793107274449697652, 3126183424824572504, ]; let rand = Rand::new(KEY); for expected in expected.chunks(2) { assert_eq!(rand.next_u64(), expected[0]); let res = rand.next_full_u64(); assert!(res.counter % 2 != 0); //counter starts from 0 so always must be true assert_eq!(res.value, expected[1]); } }