コード例 #1
0
    // Test to make sure everything works
    public int[] testByteBitConversion()
    {
        int[] passed = new int[2];

        byte[]   testByteArr   = seedToByte.seedToByte(testSeed2);
        string   testReturnStr = seedToByte.byteToSeed(testByteArr);
        BitArray testBitArr    = seedToByte.byteToBits(testByteArr);

        byte[] testReturnBytes = seedToByte.bitToByte(testBitArr);
        string testReturnStr2  = seedToByte.byteToSeed(testReturnBytes);

        int[] testActionToDo = seedToByte.bitToActions(testBitArr, actionList);

        passed[1] += 1;
        if (testSeed2 == testReturnStr)
        {
            passed[0] += 1;
        }
        else
        {
            Debug.Log("Test for conversion from byte array to string failed");
        }

        passed[1] += 1;
        if (seedToByte.byteToSeed(testByteArr) == seedToByte.byteToSeed(testReturnBytes))
        {
            passed[0] += 1;
        }
        else
        {
            Debug.Log("Test for conversion from bit array to byte array failed");
        }

        return(passed);
    }