public void SuccessAdditionTest()
        {
            int additionNumber         = 123;
            FiniteRingElement addition = ring.GetElement(additionNumber);

            Assert.That((elem + addition).Value, Is.EqualTo(20));
        }
        public void NonEqualRingsAdditionTest()
        {
            FiniteRing        otherRing = new FiniteRing(order + 1);
            FiniteRingElement addition  = otherRing.GetElement(15);

            FiniteRingElement result = elem + addition;
        }
示例#3
0
        public void setUp()
        {
            ring            = new FiniteRing(order);
            initialSequence = new FiniteRingElement[keyLength];

            for (int i = 0; i < keyLength; ++i)
            {
                initialSequence[i] = ring.GetElement((new Random()).Next());
            }
        }
 public void setUp()
 {
     ring = new FiniteRing(order);
     elem = ring.GetElement(number);
 }
        public void getElementTest()
        {
            int number = 34;

            Assert.That(obj.GetElement(number), Is.EqualTo(new FiniteRingElement(number, obj)));
        }
示例#6
0
        protected sealed override void initAlphabet()
        {
            alphabetCard = 32; // ё == е

            alphabet = new Dictionary <char, FiniteRingElement>();
            ring     = new FiniteRing(alphabetCard);

            alphabet.Add('А', ring.GetElement(0));
            alphabet.Add('Б', ring.GetElement(1));
            alphabet.Add('В', ring.GetElement(2));
            alphabet.Add('Г', ring.GetElement(3));
            alphabet.Add('Д', ring.GetElement(4));
            alphabet.Add('Е', ring.GetElement(5));
            alphabet.Add('Ж', ring.GetElement(6));
            alphabet.Add('З', ring.GetElement(7));
            alphabet.Add('И', ring.GetElement(8));
            alphabet.Add('Й', ring.GetElement(9));
            alphabet.Add('К', ring.GetElement(10));
            alphabet.Add('Л', ring.GetElement(11));
            alphabet.Add('М', ring.GetElement(12));
            alphabet.Add('Н', ring.GetElement(13));
            alphabet.Add('О', ring.GetElement(14));
            alphabet.Add('П', ring.GetElement(15));
            alphabet.Add('Р', ring.GetElement(16));
            alphabet.Add('С', ring.GetElement(17));
            alphabet.Add('Т', ring.GetElement(18));
            alphabet.Add('У', ring.GetElement(19));
            alphabet.Add('Ф', ring.GetElement(20));
            alphabet.Add('Х', ring.GetElement(21));
            alphabet.Add('Ц', ring.GetElement(22));
            alphabet.Add('Ч', ring.GetElement(23));
            alphabet.Add('Ш', ring.GetElement(24));
            alphabet.Add('Щ', ring.GetElement(25));
            alphabet.Add('Ъ', ring.GetElement(26));
            alphabet.Add('Ы', ring.GetElement(27));
            alphabet.Add('Ь', ring.GetElement(28));
            alphabet.Add('Э', ring.GetElement(29));
            alphabet.Add('Ю', ring.GetElement(30));
            alphabet.Add('Я', ring.GetElement(31));
        }