forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditDistance.fs
More file actions
27 lines (23 loc) · 1.02 KB
/
EditDistance.fs
File metadata and controls
27 lines (23 loc) · 1.02 KB
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
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.UnitTests
open System
open System.Globalization
open System.Text
open NUnit.Framework
open Microsoft.FSharp.Compiler
[<TestFixture>]
module EditDistance =
open Internal.Utilities.EditDistance
[<Test>]
[<TestCase("RICK", "RICK", ExpectedResult = "1.000")>]
[<TestCase("MARTHA", "MARHTA", ExpectedResult = "0.961")>]
[<TestCase("DWAYNE", "DUANE", ExpectedResult = "0.840")>]
[<TestCase("DIXON", "DICKSONX", ExpectedResult = "0.813")>]
let JaroWinklerTest (str1 : string, str2 : string) : string =
String.Format(CultureInfo.InvariantCulture, "{0:0.000}", JaroWinklerDistance str1 str2)
[<Test>]
[<TestCase("RICK", "RICK", ExpectedResult = 0)>]
[<TestCase("MARTHA", "MARHTA", ExpectedResult = 1)>]
[<TestCase("'T", "'u", ExpectedResult = 1)>]
let EditDistanceTest (str1 : string, str2 : string) : int =
CalcEditDistance(str1,str2)