@@ -30,6 +30,7 @@ You should have received a copy of the GNU Lesser General Public
3030using System . Threading . Tasks ;
3131using OpenVectorFormat . GCodeReaderWriter ;
3232using System . IO ;
33+ using OpenVectorFormat . ASPFileReaderWriter ;
3334
3435namespace OpenVectorFormat . ReaderWriter . UnitTests
3536{
@@ -44,13 +45,41 @@ public void TestGCodeFiles(FileInfo fileName)
4445 {
4546 var gCodeReader = new GCodeReader ( ) ;
4647
47- string testCommand = File . ReadAllLines ( fileName . FullName ) [ 21 ] ;
48- GCodeState gCodeState = new GCodeState ( testCommand ) ;
48+ string testCommandLinear = File . ReadAllLines ( fileName . FullName ) [ 19 ] ;
49+ GCodeState gCodeState = new GCodeState ( testCommandLinear ) ;
4950
50- LinearInterpolationCmd assertCmd = new LinearInterpolationCmd ( PrepCode . G , 1 , new Dictionary < char , float > { { 'F' , 1800 } , { 'X' , 110.414f } , { 'Y' , 94.025f } , { 'E' , 0.02127f } } ) ;
51+ LinearInterpolationCmd assertCmd = new LinearInterpolationCmd ( PrepCode . G , 0 , new Dictionary < char , float > { { 'F' , 1800 } , { 'X' , 110.414f } , { 'Y' , 94.025f } , { 'E' , 0.02127f } } ) ;
5152 Assert . AreEqual ( gCodeState . gCodeCommand . gCode , assertCmd . gCode ) ;
5253 Assert . AreEqual ( gCodeState . gCodeCommand . GetType ( ) , assertCmd . GetType ( ) ) ;
54+
55+ object [ ] stateUpdates = gCodeState . Update ( File . ReadAllLines ( fileName . FullName ) [ 22 ] ) ;
56+
57+ Assert . IsNotNull ( stateUpdates [ 0 ] ) ;
58+ Assert . IsNull ( stateUpdates [ 1 ] ) ;
59+ Assert . IsNull ( stateUpdates [ 2 ] ) ;
60+ }
61+
62+ [ DynamicData ( "GCodeFiles" ) ]
63+ [ TestMethod ]
64+ public void TestGCodeGrouping ( FileInfo fileName )
65+ {
66+ string [ ] testCommands = File . ReadAllLines ( fileName . FullName ) ;
67+ GCodeReader gCodeReader = new GCodeReader ( ) ;
68+
69+ GCodeCommandList gCodeCommandList = new GCodeCommandList ( testCommands ) ;
70+
71+ for ( int i = 0 ; i < 30 ; i ++ )
72+ {
73+ Console . WriteLine ( gCodeCommandList [ i ] . GetType ( ) ) ;
74+ //Console.WriteLine(gCodeCommandList[i].ToString());
75+ }
76+
77+ IEnumerable < IGrouping < Type , GCodeCommand > > gCodeTypeGrouping = gCodeCommandList . GroupBy ( gCodeCommand => gCodeCommand . GetType ( ) ) . ToList ( ) ;
78+ Console . WriteLine ( gCodeTypeGrouping . ToString ( ) ) ;
79+
80+ Assert . AreEqual ( 3 , gCodeTypeGrouping . Count ( ) ) ;
5381 }
82+
5483 public static List < object [ ] > GCodeFiles
5584 {
5685 get
0 commit comments