Sha256: a5c7c40f8e2484d4563abcb2e887d5e00006c36b0489100ece9108fa00aa290c
Contents?: true
Size: 1.02 KB
Versions: 1
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 937.8000000000001, Licensee::LevenshteinMatcher.new(@mit).max_delta end should "calculate length delta" do isc = Licensee::License.find("isc") assert_equal 0.0, Licensee::LevenshteinMatcher.new(@mit).length_delta(Licensee::License.find("mit")) assert_equal 347.0, Licensee::LevenshteinMatcher.new(@mit).length_delta(isc) end should "round up potential licenses" do assert_equal 7, Licensee::LevenshteinMatcher.new(@mit).potential_licenses.size end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
licensee-5.0.0 | test/test_licensee_levenshtein_matcher.rb |