LCOV - code coverage report
Current view: top level - maps/random/rmgen - RandomMapLogger.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 9 22 40.9 %
Date: 2023-04-02 12:52:40 Functions: 1 6 16.7 %

          Line data    Source code
       1             : function RandomMapLogger()
       2             : {
       3           8 :         this.lastTime = undefined;
       4           8 :         this.startTime = Engine.GetMicroseconds ? Engine.GetMicroseconds() : 0;
       5           8 :         this.prefix = ""; // seems noisy
       6             : 
       7             :         // Don't print in test cases
       8           8 :         if (g_MapSettings.Name)
       9           0 :                 this.printDirectly(
      10             :                         this.prefix +
      11             :                         "Generating " + g_MapSettings.Name +
      12             :                         " of size " + g_MapSettings.Size +
      13             :                         " and " + (g_MapSettings.PlayerData.length - 1) + " players.\n");
      14             : }
      15             : 
      16           6 : RandomMapLogger.prototype.printDirectly = function(string)
      17             : {
      18           0 :         log(string);
      19           0 :         print(string);
      20             : };
      21             : 
      22           6 : RandomMapLogger.prototype.print = function(string)
      23             : {
      24           0 :         this.printDuration();
      25           0 :         this.printDirectly(this.prefix + string + "...");
      26           0 :         this.lastTime = Engine.GetMicroseconds();
      27             : };
      28             : 
      29           6 : RandomMapLogger.prototype.printDuration = function()
      30             : {
      31           0 :         if (!this.lastTime)
      32           0 :                 return;
      33             : 
      34           0 :         this.printDurationDirectly("", this.lastTime);
      35           0 :         this.lastTime = Engine.GetMicroseconds();
      36             : };
      37             : 
      38           6 : RandomMapLogger.prototype.close = function()
      39             : {
      40           0 :         this.printDuration();
      41           0 :         this.printDurationDirectly(this.prefix + "Total map generation time:", this.startTime);
      42             : };
      43             : 
      44           6 : RandomMapLogger.prototype.printDurationDirectly = function(text, startTime)
      45             : {
      46           0 :         this.printDirectly(text + " " + ((Engine.GetMicroseconds() - startTime) / 1000000).toFixed(6) + "s.\n");
      47             : };

Generated by: LCOV version 1.14