LCOV - code coverage report
Current view: top level - tests - test_random.ts (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 11 23 47.8 %
Date: 2021-03-12 10:43:40 Functions: 0 4 0.0 %

          Line data    Source code
       1           1 : import { MersenneTwister19937 } from "../randomjs/engine/MersenneTwister19937.ts";
       2           1 : import { Random } from "../randomjs/Random.ts";
       3             : import { Engine } from "../randomjs/types.ts";
       4           1 : import { nativeMath } from "../randomjs/engine/nativeMath.ts";
       5             : 
       6           1 : abstract class RandomTest {
       7             :   distribution: Random;
       8           0 :   constructor(engine: Engine) {
       9           0 :     this.distribution = new Random(engine);
      10           0 :   }
      11           0 :   sample(n: number, min: number, max: number): number[] {
      12           0 :     return Array.from({ length: n }, () => this.distribution.real(min, max));
      13           0 :   }
      14           1 : }
      15             : 
      16           1 : class MersenneTwister19937Test extends RandomTest {
      17           0 :   constructor() {
      18           0 :     super(MersenneTwister19937.autoSeed());
      19           0 :   }
      20           1 : }
      21             : 
      22           1 : class NativeMathTest extends RandomTest {
      23           0 :   constructor() {
      24           0 :     super(nativeMath);
      25           0 :   }
      26           1 : }
      27             : 
      28           1 : (window as any).MersenneTwister19937Test = MersenneTwister19937Test;
      29           1 : (window as any).NativeMathTest = NativeMathTest;

Generated by: LCOV version 1.15