Пример #1
0
        public void Dil32ZIF40Placement2()
        {
            var translator = new PinTranslator(32, 40, 2);

            // .ToDil
            for (var i = 0; i <= 2; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(0));
            }
            for (var i = 3; i <= 18; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(i - 2));
            }
            for (var i = 19; i <= 21; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(0));
            }
            for (var i = 23; i <= 38; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(i - 6));
            }
            for (var i = 39; i <= 41; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(0));
            }

            // .ToZIF
            {
                var pin = new Pin {
                    EnableLow = true, Number = 0, TrueZIF = false
                };
                Assert.That(translator.ToZIF(pin), Is.EqualTo(0));
            }
            for (var i = 1; i <= 16; i++)
            {
                var pin = new Pin {
                    EnableLow = true, Number = i, TrueZIF = false
                };
                Assert.That(translator.ToZIF(pin), Is.EqualTo(i + 2));
            }
            for (var i = 17; i <= 32; i++)
            {
                var pin = new Pin {
                    EnableLow = true, Number = i, TrueZIF = false
                };
                Assert.That(translator.ToZIF(pin), Is.EqualTo(i + 6));
            }
            for (var i = 33; i <= 41; i++)
            {
                var pin = new Pin {
                    EnableLow = true, Number = i, TrueZIF = false
                };
                Assert.That(translator.ToZIF(pin), Is.EqualTo(0));
            }
        }
Пример #2
0
        public void Dil40ZIF40Placement0()
        {
            var translator = new PinTranslator(40, 40, 0);

            for (var i = 0; i <= 41; i++)
            {
                Assert.That(translator.ToDIL(i), Is.EqualTo(i <= 40 ? i : 0));
            }

            for (var i = 1; i <= 41; i++)
            {
                var pin = new Pin {
                    EnableLow = true, Number = i, TrueZIF = false
                };
                Assert.That(translator.ToZIF(pin), Is.EqualTo(i <= 40 ? i : 0));
            }
        }