# Code coverage report for dynamic-dijkstra/simple.js

# all files / dynamic-dijkstra/ simple.js

71.43% Statements 20/28
70% Branches 21/30
75% Functions 6/8
85% Lines 17/20

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41

    1×
    276×
    142×
    75×
    12×

    63×

    1×

    92×
    92×

    97×
    97×
    97×
    97×
    18×

    26×

    97×

    1×

     //what happens when you block a same-as

    function min (a, b) {
        if(a == null) return b
        if(b == null) return a
        if(Math.abs(a) == Math.abs(b)) {
          return a > b ? a : b
        }
        return Math.abs(a) < Math.abs(b) ? a : b
      }
    module.exports =  {
      lt: function (a, b) {
        if(a < 0) return false
        if(a < b) return true
      },
      min: function (a, b) {
        Iif(min(a,b) != min(b, a)) throw new Error('min not associative:'+a+','+b)
        return min(a, b)
      },
      add: function (a, v) {
        Iif(a < 0) return null
        v = v === 0 ? 0.1 : v
        Iif(isNaN(v)) throw new Error('edge distance must be a number, was:'+v)
        if(v >= 0) return a >= 0 ? a + v : a - v
        else       return a >= 0 ? a*-1 + v : a
      },
      initial: function () {
        return 0
      },
      expand: function (v, max) {
        return v >= 0 && v < max
      },
      isAdd: function (v) {
        return v >= 0
      },
      isRemove: function (v) {
        return v < 0
      }
    }