Skip to content

Commit

Permalink
minor adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoh committed Oct 17, 2023
1 parent 07d605c commit 88bfe96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions RecordParser.Benchmark/VariableLengthWriterBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
using RecordParser.Extensions.FileWriter;
using SoftCircuits.CsvParser;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
Expand Down
14 changes: 7 additions & 7 deletions RecordParser.Test/FileWriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static IEnumerable<object[]> Repeats()
}
}

// the fixed-length file scenario is already covered in the bellow test,
// the fixed-length file scenario is already covered in the test bellow,
// because "WriteRecords" method dont matters what parser is used,
// since it just receives a delegate
[Theory]
Expand Down Expand Up @@ -71,14 +71,14 @@ public void Write_csv_file(int repeat, bool parallel, bool ordered)
using var memory = new MemoryStream();
using var textWriter = new StreamWriter(memory);

var writeOptions = new ParallelismOptions()
var parallelOptions = new ParallelismOptions()
{
Enabled = parallel,
EnsureOriginalOrdering = ordered,
MaxDegreeOfParallelism = MaxParallelism,
};

textWriter.WriteRecords(expectedItems, writer.TryFormat, writeOptions);
textWriter.WriteRecords(expectedItems, writer.TryFormat, parallelOptions);
textWriter.Flush();

// Assert
Expand All @@ -87,15 +87,15 @@ public void Write_csv_file(int repeat, bool parallel, bool ordered)
using var textReader = new StreamReader(memory);
var readOptions = new VariableLengthReaderOptions()
{
ParallelismOptions = writeOptions
ParallelismOptions = parallelOptions
};

var reads = textReader.ReadRecords(reader, readOptions);
var items = textReader.ReadRecords(reader, readOptions);

if (ordered)
reads.Should().BeEquivalentTo(expectedItems, cfg => cfg.WithStrictOrdering());
items.Should().BeEquivalentTo(expectedItems, cfg => cfg.WithStrictOrdering());
else
reads.Should().BeEquivalentTo(expectedItems);
items.Should().BeEquivalentTo(expectedItems);
}
}
}

0 comments on commit 88bfe96

Please sign in to comment.