Skip to content

Commit

Permalink
Add Width/Height tests
Browse files Browse the repository at this point in the history
See #42
  • Loading branch information
cwensley committed May 23, 2021
1 parent 63f8918 commit 9abf3ea
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/artifacts/${input:configuration}/netcoreapp3.1/Eto.Parse.TestSpeed.dll",
"program": "${workspaceFolder}/artifacts/${input:configuration}/net5.0/Eto.Parse.TestSpeed.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
Expand Down
2 changes: 1 addition & 1 deletion Eto.Parse.TestSpeed/Eto.Parse.TestSpeed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net5.0</TargetFrameworks>
<TargetFrameworks>net5.0;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
Expand Down
2 changes: 1 addition & 1 deletion Eto.Parse.Tests/Eto.Parse.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;net5.0</TargetFrameworks>
<TargetFrameworks>net5.0;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
32 changes: 32 additions & 0 deletions Eto.Parse.Tests/Samples/WidthHeightTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using Eto.Parse.Parsers;
using Eto.Parse.Writers;
using NUnit.Framework;

namespace Eto.Parse.Tests.Samples
{
[TestFixture]
public class WidthHeightTests
{
[Test]
public void TestWidthHeight()
{
var space = +Terminals.WhiteSpace;
Parser eq = "=";

var intParser = new NumberParser { AllowDecimal = false, AllowExponent = false, ValueType = typeof(int) };

var width = ("width" & eq & intParser.Named("width")).Separate();
var height = ("height" & eq & intParser.Named("height")).Separate();

var whhw = (width & space & height) | (height & space & width);

var whhwGrammar = new Grammar(whhw);
Console.WriteLine(new DisplayParserWriter().Write(whhwGrammar));
var matches = whhwGrammar.Match("width=400 height=800");
Assert.That(matches.HasMatches);
Assert.AreEqual(400, matches["width"].Value);
Assert.AreEqual(800, matches["height"].Value);
}
}
}
4 changes: 4 additions & 0 deletions Eto.Parse/Eto.Parse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Eto.Parse is a highly optimized recursive decent LL(k) parser framework that can
You can use BNF, EBNF, or Gold parser grammars to define your parser, code them directly using a fluent API, or use shorthand operators (or a mix of each).
</PackageDescription>
<PackageReleaseNotes>
Change for v1.6:
* Fixed CharSetTerminal.CaseSensitive as it was inverted
* Add support for CharRangeTerminal.CaseSensitive

Changes for v1.5:
* Add .NET Standard 2.0 target
* Add .NET 4.5 target
Expand Down

0 comments on commit 9abf3ea

Please sign in to comment.