예제 #1
0
        public void ToJsonTest4()
        {
            var ds = TestSuiteDataSource.Ds100Gcode.Split("\n");

            foreach (var r in ds)
            {
                var res = GcodeParser.ToJson(r);
                Assert.IsTrue(res.StartsWith("{") && res.EndsWith("}"));
            }
        }
예제 #2
0
        public void ToJsonTest1()
        {
            const string raw      = "G1 X626.713 Y251.523 E12.01248; Haha";
            var          expected = "{\"G\":\"1\",\"X\":\"626.713\",\"Y\":\"251.523\",\"E\":\"12.01248\",\"Comment\":\"Haha\"}";

            //\r\n\t
            expected = expected.Replace("\r", null);
            expected = expected.Replace("\n", null);
            expected = expected.Replace("\t", null);
            var res = GcodeParser.ToJson(raw);

            Assert.AreEqual(expected, res);
        }