You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/09/11 21:31:13 UTC
[42/50] [abbrv] lucenenet git commit: Fixed ToStringUtils.Boost() for
when the number to the left of the decimal is 0.
Fixed ToStringUtils.Boost() for when the number to the left of the decimal is 0.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/34284ee1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/34284ee1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/34284ee1
Branch: refs/heads/master
Commit: 34284ee1ec18cc5ba76b2bc0a060b682de53f13c
Parents: 66ab301
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Aug 7 19:41:27 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Sep 2 22:31:19 2016 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/ToStringUtils.cs | 2 +-
src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/34284ee1/src/Lucene.Net.Core/Util/ToStringUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ToStringUtils.cs b/src/Lucene.Net.Core/Util/ToStringUtils.cs
index 3e1f938..2fcf898 100644
--- a/src/Lucene.Net.Core/Util/ToStringUtils.cs
+++ b/src/Lucene.Net.Core/Util/ToStringUtils.cs
@@ -38,7 +38,7 @@ namespace Lucene.Net.Util
if (boost != 1.0f)
{
// .NET compatibility fix
- return "^" + boost.ToString(".0######", CultureInfo.InvariantCulture);
+ return "^" + boost.ToString("0.0######", CultureInfo.InvariantCulture);
}
else
return "";
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/34284ee1/src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs b/src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs
index a48cd23..6839745 100644
--- a/src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestToStringUtils.cs
@@ -33,6 +33,8 @@ namespace Lucene.Net.Core.Util
float boostFractional = 2.5f;
float boostNonFractional = 5f;
float boostLong = 1.111111111f;
+ float boostZeroNonFractional = 0f;
+ float boostZeroFractional = 0.123f;
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures | CultureTypes.NeutralCultures))
{
@@ -42,6 +44,8 @@ namespace Lucene.Net.Core.Util
assertEquals("^2.5", ToStringUtils.Boost(boostFractional));
assertEquals("^5.0", ToStringUtils.Boost(boostNonFractional));
assertEquals("^1.111111", ToStringUtils.Boost(boostLong));
+ assertEquals("^0.0", ToStringUtils.Boost(boostZeroNonFractional));
+ assertEquals("^0.123", ToStringUtils.Boost(boostZeroFractional));
}
}
}