Example #1
0
        public void Base64Test()
        {
            TestTool
            .RunTasks(ThreadCount,
                      () => {
                var encodedStr  = originalData.EncodeBase64();
                var decodedData = encodedStr.DecodeBase64();

                // Console.WriteLine("Encoded String: " + encodedStr);

                Assert.IsTrue(ArrayTool.Compare(originalData, decodedData));
            });
        }
Example #2
0
        public void Params_CombineInOrder_Test(int x, int y, int z, int k)
        {
            var codes        = new[] { x, y, z, k };
            var codesReverse = codes.Reverse().ToArray();

            int hash1 = HashTool.Compute(codes);
            int hash2 = HashTool.Compute(codesReverse);

            if (ArrayTool.Compare(codes, codesReverse))
            {
                Assert.AreEqual(hash1, hash2, "hash1={0}, hash2={1}", hash1, hash2);
            }
            else
            {
                Assert.AreNotEqual(hash1, hash2, "hash1={0}, hash2={1}", hash1, hash2);
            }
        }
Example #3
0
        public void Params_Combine_Test(int x, int y, int z, int k)
        {
            var codes        = new[] { x, y, z, k };
            var codesReverse = new[] { k, z, y, x };

            var hash1 = HashTool.Compute(codes);
            var hash2 = HashTool.Compute(codesReverse);

            if (ArrayTool.Compare(codes, codesReverse))
            {
                Assert.AreEqual(hash1, hash2, "두 Array의 값이 같다면, HashCode 값도 같아야 합니다.");
            }
            else
            {
                Assert.AreNotEqual(hash1, hash2, "HashTool.Compute은 입력 값의 순서에 따라서도 HashCode 값이 달라야 합니다.");
            }
        }
Example #4
0
        public void CompareTest()
        {
            const int Length = 10;

            var array1 = new string[Length];
            var array2 = new string[Length];

            for (int i = 0; i < Length; i++)
            {
                array1[i] = i.ToString();
            }

            for (int i = 0; i < Length; i++)
            {
                array2[i] = i.ToString();
            }

            Assert.IsTrue(ArrayTool.Compare(array1, array2));
        }