Esempio n. 1
0
        public void test2()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "test2.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "DB9",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                },
                pins = new List <string>()
                {
                    "PIN1",
                    "PIN2",
                    "PIN3",
                    "PIN4",
                    "PIN5",
                    "PIN6",
                    "PIN7",
                    "PIN8",
                    "PIN9"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 2
0
        public void test01()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "L_LINEAR.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "L_LINEAR",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "Inductance", "10e-6" },
                    { "Rs", "0.01" },
                    { "Cp", "2e-12" },
                    { "Rp", "300e3" },
                },
                pins = new List <string>()
                {
                    "1",
                    "2"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 3
0
        public void nameCharsTestPass()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "nameCharsTestPass.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "AaBbCXxYyZz!#$%[0189]_",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                },
                pins = new List <string>()
                {
                    "1",
                    "2"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 4
0
        public void firstLineCommentTest()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "firstLineCommentTest.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "RES_2ndLineComponent",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                },
                pins = new List <string>()
                {
                    "1",
                    "2"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 5
0
        public void test3()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "test3.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "RES_0603_330",
                elementType = 'R',
                parameters  = new Dictionary <String, String>()
                {
                },
                pins = new List <string>()
                {
                    "PIN1",
                    "PIN2"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 6
0
        public void q2n222a()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "q2n222a.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "Q2N222A",
                elementType = 'Q',
                parameters  = new Dictionary <String, String>()
                {
                },
                pins = new List <string>()
                {
                    "COLLECTOR",
                    "BASE",
                    "EMITTER"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 7
0
        public void multiparams()
        {
            Parse         myParser = new Parse();
            string        filename = Path.Combine(Path_TestModels, "multiparams.cir");
            ComponentInfo result   = myParser.ParseFile(filename);

            ComponentInfo expected = new ComponentInfo()
            {
                name        = "RES_MP",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "RVAL", "1.0k" },
                    { "LVAL", "800pH" }
                },
                pins = new List <string>()
                {
                    "1",
                    "2"
                }
            };

            Assert.True(result.Equals(expected));
        }
Esempio n. 8
0
        public void test00()
        {
            // Create a ComponentInfo class and set initial values.
            ComponentInfo ci = new ComponentInfo()
            {
                name        = "RES_0603",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "RVAL", "1.0k" },
                    { "Bogus", "Yeah" }
                },
                pins = new List <string>()
                {
                    "PinOne",
                    "PinTwo"
                }
            };

            Assert.False(ci.Equals(null));
            Assert.True(ci.Equals(ci));

            // Create a ComponentInfo class and set initial values the same as before.
            ComponentInfo ci2 = new ComponentInfo()
            {
                name        = "RES_0603",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "RVAL", "1.0k" },
                    { "Bogus", "Yeah" }
                },
                pins = new List <string>()
                {
                    "PinOne",
                    "PinTwo"
                }
            };

            Assert.True(ci.Equals(ci2));
            Assert.True(ci2.Equals(ci2));
            Assert.True(ci2.Equals(ci));

            // Create a ComponentInfo class but don't set initial values.
            ComponentInfo ci3 = new ComponentInfo();

            Assert.True(ci3.Equals(ci3));
            Assert.False(ci2.Equals(ci3));
            Assert.False(ci3.Equals(ci));

            // Create a ComponentInfo class and set initial values slightly differently.
            ComponentInfo ci4 = new ComponentInfo()
            {
                name        = "RES_0603",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "RVAL", "1.0k" }
                },
                pins = new List <string>()
                {
                    "PinOne",
                    "PinTwo"
                }
            };

            Assert.True(ci4.Equals(ci4));
            Assert.False(ci2.Equals(ci4));

            // Create a ComponentInfo class with the pins in a different order.
            ComponentInfo ci5 = new ComponentInfo()
            {
                name        = "RES_0603",
                elementType = 'X',
                parameters  = new Dictionary <String, String>()
                {
                    { "RVAL", "1.0k" }
                },
                pins = new List <string>()
                {
                    "PinTwo",
                    "PinOne",
                }
            };


            Assert.True(ci5.Equals(ci5));
            Assert.False(ci5.Equals(ci4));
        }