Skip to content

Commit

Permalink
Merge pull request #2998 from KevinBrogan/KevinBrogan-std.csv-patch
Browse files Browse the repository at this point in the history
Fix std.csv assertion (float comparison for equal)
  • Loading branch information
burner committed Feb 19, 2015
2 parents 320a7b4 + 608ff99 commit 1ff5a14
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions std/csv.d
Expand Up @@ -510,6 +510,8 @@ auto csvReader(Contents = string,
// Test structure conversion interface with unicode.
@safe pure unittest
{
import std.math : abs;

wstring str = "\U00010143Hello,65,63.63\nWorld,123,3673.562"w;
struct Layout
{
Expand All @@ -533,7 +535,7 @@ auto csvReader(Contents = string,
{
assert(ans[count].name == record.name);
assert(ans[count].value == record.value);
assert(ans[count].other == record.other);
assert(abs(ans[count].other - record.other) < 0.00001);
count++;
}
assert(count == ans.length);
Expand All @@ -556,6 +558,8 @@ auto csvReader(Contents = string,
// Test struct & header interface and same unicode
unittest
{
import std.math : abs;

string str = "a,b,c\nHello,65,63.63\n➊➋➂❹,123,3673.562";
struct Layout
{
Expand All @@ -579,7 +583,7 @@ unittest
{
assert(ans[count].name == record.name);
assert(ans[count].value == record.value);
assert(ans[count].other == record.other);
assert(abs(ans[count].other - record.other) < 0.00001);
count++;
}
assert(count == ans.length);
Expand Down

0 comments on commit 1ff5a14

Please sign in to comment.