Exemplo n.º 1
0
 public void TestInvertCase()
 {
     Assertions.AssertEquals('X', InvertCase('x'));
     Assertions.AssertEquals('k', InvertCase('K'));
     Assertions.AssertEquals('C', InvertCase('c'));
     Assertions.AssertEquals('d', InvertCase('D'));
 }
Exemplo n.º 2
0
 public void TestToUppercase()
 {
     Assertions.AssertEquals('X', ToUppercase('x'));
     Assertions.AssertEquals('K', ToUppercase('k'));
     Assertions.AssertEquals('C', ToUppercase('c'));
     Assertions.AssertEquals('D', ToUppercase('d'));
 }
Exemplo n.º 3
0
 public void TestToLowercase()
 {
     Assertions.AssertEquals('x', ToLowercase('X'));
     Assertions.AssertEquals('k', ToLowercase('K'));
     Assertions.AssertEquals('c', ToLowercase('C'));
     Assertions.AssertEquals('d', ToLowercase('D'));
 }
Exemplo n.º 4
0
        public void TestXorSwap()
        {
            var first  = 621;
            var second = 2048;

            XorSwap(ref first, ref second);

            Assertions.AssertEquals(2048, first);
            Assertions.AssertEquals(621, second);
        }
Exemplo n.º 5
0
        public void TestGetPositionOfRightmostBit()
        {
            var n1 = 0b1001;
            var n2 = 0b0000;
            var n3 = 0b10100;
            var n4 = 0b11000;

            Assertions.AssertEquals(0b1, GetPositionOfRightmostBit(n1));
            Assertions.AssertEquals(0, GetPositionOfRightmostBit(n2));
            Assertions.AssertEquals(0b100, GetPositionOfRightmostBit(n3));
            Assertions.AssertEquals(0b1000, GetPositionOfRightmostBit(n4));
        }
Exemplo n.º 6
0
        public void TestFindPositionInAlphabet()
        {
            Assertions.AssertEquals(26, FindPositionInAlphabet('z'));
            Assertions.AssertEquals(26, FindPositionInAlphabet('Z'));

            Assertions.AssertEquals(1, FindPositionInAlphabet('a'));
            Assertions.AssertEquals(1, FindPositionInAlphabet('A'));

            Assertions.AssertEquals(5, FindPositionInAlphabet('e'));
            Assertions.AssertEquals(5, FindPositionInAlphabet('E'));

            Assertions.AssertEquals(10, FindPositionInAlphabet('j'));
            Assertions.AssertEquals(10, FindPositionInAlphabet('J'));
        }
Exemplo n.º 7
0
        public void TestIncrement()
        {
            var v1 = 100;
            var v2 = 15;
            var v3 = -44;

            Increment(ref v1);

            Increment(ref v2);
            Increment(ref v2);

            Increment(ref v3);
            Increment(ref v3);
            Increment(ref v3);

            Assertions.AssertEquals(101, v1);
            Assertions.AssertEquals(17, v2);
            Assertions.AssertEquals(-41, v3);
        }