class IntersectionTest

Testing for the class

Public Instance Methods

test_exact() click to toggle source
# File _plugins/gtn/supported.rb, line 187
def test_exact
  data = {
    'servers' => { 0 => 's0', 1 => 's1', 2 => 's2' },
    'tools' => {
      'upload1' => {
        '_' => [0, 1, 2]
      },
      'ts/repos/hexy/lena/tool1' => {
        '1.0' => [0, 1],
        '2.0' => [0, 2]
      }
    }
  }

  # Inexact here is empty because all are exactly supporting
  assert_equal(Gtn::Supported.calculate(data, ['upload1']), { exact: %w[s0 s1 s2], inexact: [] })
  assert_equal(Gtn::Supported.calculate(data, ['upload1', 'ts/repos/hexy/lena/tool1/1.0']),
               { exact: %w[s0 s1], inexact: %w[s2] })
  assert_equal(Gtn::Supported.calculate(data, ['upload1', 'ts/repos/hexy/lena/tool1/2.0']),
               { exact: %w[s0 s2], inexact: %w[s1] })
  assert_equal(Gtn::Supported.calculate(data, %w[upload1 unknown-tool]),
               { exact: %w[], inexact: %w[] })
end