Sha256: b67dd9d94188983b6ccaf33b30c7383190daa6a0b5b2d482add6ea2c1cff9f40
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'helper' class TestLicenseeLevenshteinMatcher < Minitest::Test def setup text = license_from_path( Licensee::License.find("mit").path ) blob = FakeBlob.new(text) @mit = Licensee::ProjectFile.new(blob, "LICENSE") end should "match the license" do assert_equal "mit", Licensee::LevenshteinMatcher.match(@mit).key end should "know the match confidence" do matcher = Licensee::LevenshteinMatcher.new(@mit) assert matcher.confidence > 98, "#{matcher.confidence} < 98" end should "calculate max delta" do assert_equal 964.8000000000001, Licensee::LevenshteinMatcher.new(@mit).max_delta end should "calculate length delta" do isc = Licensee::License.find("isc") assert_equal 2, Licensee::LevenshteinMatcher.new(@mit).length_delta(Licensee::License.find("mit")) assert_equal 334, Licensee::LevenshteinMatcher.new(@mit).length_delta(isc) end should "round up potential licenses" do assert_equal 6, Licensee::LevenshteinMatcher.new(@mit).potential_licenses.size end end
Version data entries
4 entries across 4 versions & 1 rubygems