예제 #1
0
        public void calculateValuePermutationTest()
        {
            int n      = 3;
            int k      = 0;
            int result = AbsolutePermutation.calculateValuePermutation(n, k);

            Assert.AreEqual(4, result);
        }
예제 #2
0
        public void divisonValueForPositionTest()
        {
            int n      = 1;
            int k      = 2;
            int result = AbsolutePermutation.divisonValueForPosition(n, k);

            Assert.AreEqual(2, result);
        }
예제 #3
0
        public void checkDivisionPositinforElementTrueTest()
        {
            int n = 2;
            int k = 1;

            Boolean result = AbsolutePermutation.checkDivisionPositinAndElement(n, k);

            Assert.AreEqual(true, result);
        }
예제 #4
0
        public void absolutePermutationTestCase1Step3()
        {
            int n = 3;
            int k = 2;

            int[] result = AbsolutePermutation.absolutePermutation(n, k);

            Assert.AreEqual(-1, result[0]);
        }
예제 #5
0
        public void checkInputValuesFalseTest()
        {
            int n = 5;
            int k = 2;

            Boolean result = AbsolutePermutation.checkInputValues(n, k);

            Assert.AreEqual(false, result);
        }
예제 #6
0
        public void checkInputValuesTrueFor0Test()
        {
            int n = 1;
            int k = 0;

            Boolean result = AbsolutePermutation.checkInputValues(n, k);

            Assert.AreEqual(true, result);
        }
예제 #7
0
        public void checkDivisionPositinAndElementFalseTest()
        {
            int n = 7;
            int k = 3;

            Boolean result = AbsolutePermutation.checkDivisionPositinAndElement(n, k);

            Assert.AreEqual(false, result);
        }
예제 #8
0
        public void absolutePermutationTestCase1Step1()
        {
            int n = 2;
            int k = 1;

            int[] result = AbsolutePermutation.absolutePermutation(n, k);

            Assert.AreEqual(2, result[0]);
            Assert.AreEqual(1, result[1]);
        }
예제 #9
0
        public void MainFlow(string inputString, string expectedString)
        {
            var input    = new StringReader(inputString);
            var expected = new StringReader(expectedString);

            int t = Convert.ToInt32(input.ReadLine());

            for (int tItr = 0; tItr < t; tItr++)
            {
                string[] nk = input.ReadLine().Split(' ');

                int n = Convert.ToInt32(nk[0]);

                int k = Convert.ToInt32(nk[1]);

                int[] result = AbsolutePermutation.absolutePermutation(n, k);

                var finalResult = string.Join(" ", result);
                var fExpected   = expected.ReadLine();
                Assert.AreEqual(fExpected, finalResult);
            }
        }