Skip to content

Commit 766a2d7

Browse files
author
Sven
committed
Updated tests.
1 parent 6854b48 commit 766a2d7

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

ReaderWriter/UnitTests/GCodeTest.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class GCodeTest
4141
{
4242
public static DirectoryInfo dir = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "TestFiles"));
4343

44+
45+
// Consider moving this to GCodeWriter
4446
[DynamicData("GCodeFiles")]
4547
[TestMethod]
4648
public void TestGCodeFile(FileInfo fileName)
@@ -74,12 +76,20 @@ static bool IsValidGCode(string[] commandLines)
7476

7577
[DynamicData("GCodeFiles")]
7678
[TestMethod]
77-
public void TestGCodeCmdLineToObject(FileInfo fileName)
79+
public void TestGCodeToObject(FileInfo fileName)
7880
{
7981
string[] testCommands = File.ReadAllLines(fileName.FullName);
8082

8183
GCodeCommandList gCodeCommandList = new GCodeCommandList(testCommands);
82-
Assert.AreEqual(testCommands.Length, gCodeCommandList.Count);
84+
Assert.AreEqual(19335, gCodeCommandList.OfType<LinearInterpolationCmd>().ToList().Count);
85+
Assert.AreEqual(185, gCodeCommandList.OfType<MiscCommand>().ToList().Count);
86+
87+
Assert.AreEqual("set extruder temp", gCodeCommandList[4].comment);
88+
Assert.AreEqual(new Dictionary<char, float> {{'E', 0f}}, gCodeCommandList[15].miscParams);
89+
Assert.AreEqual(2100f, ((MovementCommand) gCodeCommandList[17]).feedRate);
90+
Assert.IsTrue(((LinearInterpolationCmd) gCodeCommandList[23]).isOperation);
91+
Assert.AreEqual(PrepCode.Comment, gCodeCommandList[305].gCode.preparatoryFunctionCode);
92+
Assert.IsFalse(((LinearInterpolationCmd) gCodeCommandList[403]).isOperation);
8393
}
8494

8595
public static List<object[]> GCodeFiles

0 commit comments

Comments
 (0)