ParseArray Fails When First term Is a Symbol
andydavidsmith opened this issue · comments
andy smith commented
Hi if I have a an array of symbols the parsing fails as it looks for the entire string as a symbol but doesn't
the unit test below shows the behavior
using fitSharp.Fit.Model;
using fitSharp.Fit.Operators;
using fitSharp.Machine.Engine;
using fitSharp.Machine.Model;
using fitSharp.Samples.Fit;
using NUnit.Framework;
namespace fitSharp.Test.NUnit.Fit
{
[TestFixture]
public class ParseArraySymbols
{
[Test]
public void AllSymbols()
{
CheckParse("<<Name1,<<Name2,<<Name3", new string[] { "TED", "GEOFF", "BOB" });
}
[Test]
public void FirstItemNotSymbols()
{
CheckParse("TED,<<Name2,<<Name3", new string[] { "TED", "GEOFF", "BOB" });
}
private static void CheckParse(string input, string[] expected)
{
ParseArray parser = new ParseArray { Processor = Builder.CellProcessor() };
Symbols sym = (Symbols)parser.Processor.Memory.GetItem("Symbols");
sym.Save("Name1", "TED");
sym.Save("Name2", "GEOFF");
sym.Save("Name3", "BOB");
Assert.IsTrue(parser.CanParse(typeof(string[]), TypedValue.Void, new CellTreeLeaf(input)));
TypedValue result = parser.Parse(typeof(string[]), TypedValue.Void, new CellTreeLeaf(input));
Assert.AreEqual(expected, result.Value);
}
}
}
Mike Stockdale commented
fixed release 2.4