Add ExtraTSV
This commit is contained in:
14
SaneTsv/ExtraTsvTest/ExtraTsvTest.csproj
Normal file
14
SaneTsv/ExtraTsvTest/ExtraTsvTest.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ExtraTsv\ExtraTsv.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
20
SaneTsv/ExtraTsvTest/Program.cs
Normal file
20
SaneTsv/ExtraTsvTest/Program.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using NathanMcRae;
|
||||
using System.Text;
|
||||
|
||||
{
|
||||
string testName = "Bool test";
|
||||
string testString1 = "# ExtraTSV V0.0.1\n" +
|
||||
"column1:ty\\#pe:boolean\tcolumn2:binary\tcolumnthree\\nyep:iso8601:string" +
|
||||
"\nTRUE\tvalue\\\\t\0woo\t2024-02-15T18:03:30.0000" +
|
||||
"\nFALSE\tnother\t2024-02-15T18:03:39.0001";
|
||||
|
||||
ExtraTsv parsed = ExtraTsv.ParseExtraTsv(Encoding.UTF8.GetBytes(testString1));
|
||||
if (parsed.Records[0]["column1:ty#pe"] is bool result && result)
|
||||
{
|
||||
Console.WriteLine($"Passed {testName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Failed {testName}");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user