public void AlphaGoGame3IsSuccessfullyParsed() { var parser = new SgfParser(); var collection = SgfTestHelpers.ParseFile(parser, "Valid/AlphaGo3.sgf"); Assert.IsFalse(parser.HasWarnings); }
public void AlphaGoGame1IsSuccessfullyParsed() { var parser = new SgfParser(); var collection = SgfTestHelpers.ParseFile(parser, "Valid/AlphaGo1.sgf"); //the file has one non-standard property - MULTIGOGM Assert.AreEqual(1, parser.Warnings.Count); }
/// <summary> /// Tests all files in an invalid folder for exceptions /// </summary> /// <param name="invalidFolder">Invalid SGF files folder</param> private void InvalidSgfFolderTest(string invalidFolder) { var parser = new SgfParser(); var files = SgfTestHelpers.GetSgfFiles(Path.Combine("Invalid", invalidFolder)); foreach (var file in files) { try { parser.Parse(File.ReadAllText(file)); Assert.Fail($"File {file} did not fail parsing"); } catch (SgfParseException) { //ok } } }
public void ExampleSgfFileIsSuccessfullyParsed() { var parser = new SgfParser(); var collection = SgfTestHelpers.ParseFile(parser, "Valid/ff4_ex.sgf"); //check the root game tree count Assert.AreEqual(2, collection.Count()); var firstGameTree = collection.First(); //check the game info properties Assert.AreEqual(1, firstGameTree.Sequence.Count()); var rootNode = firstGameTree.Sequence.First(); Assert.AreEqual("Gametree 1: properties", rootNode["GN"].Value <string>()); var markupTree = firstGameTree.Children.ElementAt(2); Assert.AreEqual("Markup", markupTree.Sequence.First()["N"].Value <string>()); }