LCOV - code coverage report
Current view: top level - src/core/prng/process-seed - index.js (source / functions) Hit Total Coverage
Test: cov_profile.lcov Lines: 22 22 100.0 %
Date: 2021-12-16 00:47:58 Functions: 5 5 100.0 %
Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :         46 : import xor from "../xor.js";
       2            [ + ]:         46 : 
       3                 :         46 : const stringToIntegers = (str) => str.split("").map((i) => i.charCodeAt(0));
       4            [ + ]:         46 : 
       5                 :         46 : const compound = (memo, i) => xorify(memo + i);
       6                 :         46 : 
       7                 :         46 : const xorify = (input) => xor(input % 0x7fffffff).random() * 0x7fffffff;
       8                 :         46 : 
       9                 :         46 : const prepareSeed = (input) =>
      10                 :       1642 :   typeof input === "string"
      11                 :       1642 :     ? stringToIntegers(input).reduce(compound, 0)
      12            [ + ]:         46 :     : input;
      13            [ + ]:         46 : 
      14                 :         46 : const processSeed = (inputSeed, path = []) =>
      15                 :         46 :   [inputSeed, ...path].map(prepareSeed).reduce(compound, 0);
      16                 :         46 : 
      17                 :         46 : export default processSeed;
      18                 :         46 : 
      19                 :         46 : export const EXPOSE_FOR_TEST = {
      20                 :         46 :   xorify,
      21                 :         46 :   prepareSeed,
      22                 :         23 : };

Generated by: LCOV version 1.15