@@ -3,23 +3,25 @@ namespace FSharp.Compiler.UnitTests
33
44open System
55open System.Globalization
6- open NUnit.Framework
6+ open Xunit
7+ open FSharp.Test .Utilities
78
8- [<TestFixture>]
99module EditDistance =
1010 open Internal.Utilities .EditDistance
1111
12- [<Test >]
13- [<TestCase ( " RICK" , " RICK" , ExpectedResult = " 1.000" ) >]
14- [<TestCase ( " MARTHA" , " MARHTA" , ExpectedResult = " 0.961" ) >]
15- [<TestCase ( " DWAYNE" , " DUANE" , ExpectedResult = " 0.840" ) >]
16- [<TestCase ( " DIXON" , " DICKSONX" , ExpectedResult = " 0.813" ) >]
17- let JaroWinklerTest ( str1 : string , str2 : string ) : string =
12+ [<Theory >]
13+ [<InlineData ( " RICK" , " RICK" , " 1.000" ) >]
14+ [<InlineData ( " MARTHA" , " MARHTA" , " 0.961" ) >]
15+ [<InlineData ( " DWAYNE" , " DUANE" , " 0.840" ) >]
16+ [<InlineData ( " DIXON" , " DICKSONX" , " 0.813" ) >]
17+ let JaroWinklerTest ( str1 : string , str2 : string , expected : string ) : unit =
1818 String.Format( CultureInfo.InvariantCulture, " {0:0.000}" , JaroWinklerDistance str1 str2)
19+ |> Assert.shouldBe expected
1920
20- [<Test>]
21- [<TestCase( " RICK" , " RICK" , ExpectedResult = 0 ) >]
22- [<TestCase( " MARTHA" , " MARHTA" , ExpectedResult = 1 ) >]
23- [<TestCase( " 'T" , " 'u" , ExpectedResult = 1 ) >]
24- let EditDistanceTest ( str1 : string , str2 : string ) : int =
25- CalcEditDistance( str1, str2)
21+ [<Theory>]
22+ [<InlineData( " RICK" , " RICK" , 0 ) >]
23+ [<InlineData( " MARTHA" , " MARHTA" , 1 ) >]
24+ [<InlineData( " 'T" , " 'u" , 1 ) >]
25+ let EditDistanceTest ( str1 : string , str2 : string , expected : string ) : unit =
26+ CalcEditDistance( str1, str2)
27+ |> Assert.shouldBe expected
0 commit comments