Пример #1
0
        //EXECUTION
        protected override void InternalExecution()
        {
            IClassicBit ClassicbitA = ClassicDatatypeFactory.generateBit();
            ClassicbitA.setBit(false);
            TesterLog("ClassicBit Integrity Test", "Write", false, ClassicbitA.Debugger.ShortDebug);
            TesterLog("ClassicBit Integrity Test", "Read",  ClassicbitA.getBit(), ClassicbitA.Debugger.ShortDebug);
            ClassicbitA.setBit(true);
            TesterLog("ClassicBit Integrity Test", "Write", true, ClassicbitA.Debugger.ShortDebug);
            TesterLog("ClassicBit Integrity Test", "Read",  ClassicbitA.getBit(), ClassicbitA.Debugger.ShortDebug);

            short sizeA = 8;
            short dataA = 42; //Numero mágico
            IClassicArrayBit classicbitarrayA = ClassicDatatypeFactory.generateBitArray(sizeA);
            ConverterBinary conversionA = new ConverterBinary(dataA, sizeA);
            bool[] dataarrayA = conversionA.ToBoolArray();
            classicbitarrayA.setBitArray(dataarrayA);
            TesterLog("ClassicBitArray Integrity Test", "Write", ArrayTools.BoolArrayToString(classicbitarrayA.getBitArray()), classicbitarrayA.Debugger.ShortDebug);
            TesterLog("ClassicBitArray Integrity Test", "Read",  ArrayTools.BoolArrayToString(classicbitarrayA.getBitArray()), classicbitarrayA.Debugger.ShortDebug);

            short sizeB = 8;
            short dataB = (short)(RandomnessAlgorithmFactory.GetSingleIntenger());
            IClassicArrayBit classicbitarrayB = ClassicDatatypeFactory.generateBitArray(sizeB);
            ConverterBinary conversionB = new ConverterBinary(dataB, sizeB);
            bool[] dataarrayB = conversionB.ToBoolArray();
            classicbitarrayB.setBitArray(dataarrayB);
            TesterLog("ClassicBitArray Integrity Test", "Write", ArrayTools.BoolArrayToString(dataarrayB), classicbitarrayB.Debugger.ShortDebug);
            TesterLog("ClassicBitArray Integrity Test", "Read",  ArrayTools.BoolArrayToString(classicbitarrayB.getBitArray()), classicbitarrayB.Debugger.ShortDebug);

            //short sizeC = 8;
            //short dataC = 42; //Numero mágico
            //IClassicBitArray ClassicbitarrayC;
            //ConversionBinary conversionC = new ConversionBinary(dataC, sizeC);
            //bool[] dataarrayC = conversionC.ToBoolArray();
            //bool[] basisboolC = FactoryRandom.GetManyBinary(sizeC);
            //bool[] errorboolC = FactoryRandom.GetManyBinary(sizeC);
            //TesterLog("ClassicBitArray RANDOM CODING");
            //TesterLog("Random basis" + ArrayTools.BoolArrayToString(basisboolC));
            //TesterLog("Erroneus basis" + ArrayTools.BoolArrayToString(errorboolC));
            //TesterLog("Store " + ArrayTools.BoolArrayToString(dataarrayC) + "... ");
            //ClassicbitarrayC = ClassicDataFactory.encodeArrayByBasis(dataarrayC, basisboolC);
            //TesterLog("CORRECT Read Data");
            //bool[] decodedokC = ClassicDataFactory.decodeArrayByBasis(ClassicbitarrayC, basisboolC);
            //TesterLog(ArrayTools.BoolArrayToString(decodedokC));
            //TesterLog("ERRONEOUS Read Data");
            //bool[] decodederroneusC = ClassicDataFactory.decodeArrayByBasis(ClassicbitarrayC, errorboolC);
            //TesterLog(ArrayTools.BoolArrayToString(decodederroneusC));
            //TesterLog("AGAIN CORRECT Read Data");
            //bool[] decodedagainC = ClassicDataFactory.decodeArrayByBasis(ClassicbitarrayC, basisboolC);
            //TesterLog(ArrayTools.BoolArrayToString(decodedagainC));

            short sizeD = 8;
            bool[] dataarrayD = RandomnessAlgorithmFactory.GetManyBinary(sizeD);
            IClassicArrayBit ClassicbitarrayD = ClassicDatatypeFactory.generateBitArrayByUsualBasis(dataarrayD);
            TesterLog("ClassicBitArray Coding", "Write", ArrayTools.BoolArrayToString(dataarrayD), ClassicbitarrayD.Debugger.ShortDebug);
            TesterLog("ClassicBitArray Coding","Read",ArrayTools.BoolArrayToString(ClassicbitarrayD.getBitArray()), ClassicbitarrayD.Debugger.ShortDebug);
        }
Пример #2
0
        //EXECUTION
        protected override void InternalExecution()
        {
            IQuantumBit quantumbitA = QuantumDatatypeFactory.generateBit();
            quantumbitA.setBit(false);
            AreEqual(
                "QuantumBit Integrity Test Store FALSE",
                quantumbitA.Debugger.ShortDebug,
                "[ [ (+1000000, +0000000i) ], [ (+0000000, +0000000i) ] ]"
                );
            AreEqual(
                "Internal state Read Data",
                quantumbitA.getBit(),
                "[ [ (+1000000, +0000000i) ], [ (+0000000, +0000000i) ] ]"
                );
            quantumbitA.setBit(true);
            AreEqual(
                "QuantumBit Integrity Test Store TRUE",
                quantumbitA.Debugger.ShortDebug,
                "[ [ (+1000000, +0000000i) ], [ (+0000000, +0000000i) ] ]"
                );
            AreEqual(
                "Internal state Read Data",
                quantumbitA.getBit(),
                "[ [ (+1000000, +0000000i) ], [ (+0000000, +0000000i) ] ]"
                );

            short sizeA=8;
            short dataA=42; //Numero mágico
            IQuantumArrayBit quantumbitarrayA = QuantumDatatypeFactory.generateBitArray(sizeA);
            ConverterBinary conversionA = new ConverterBinary(dataA, sizeA);
            bool[] dataarrayA = conversionA.ToBoolArray();

            quantumbitarrayA.setBitArray(dataarrayA);
            AreEqual(
                "QuantumBitArray Integrity Test Store",
                quantumbitarrayA.Debugger.ShortDebug,
                ArrayTools.BoolArrayToString(dataarrayA)
                );
            AreEqual(
                "QuantumBitArray Integrity Test Read",
                quantumbitarrayA.Debugger.ShortDebug,
                ArrayTools.BoolArrayToString(quantumbitarrayA.getBitArray())
                );

            short sizeB = 8;
            short dataB = (short)(RandomnessFactory.GetSingleIntenger());
            IQuantumArrayBit quantumbitarrayB = QuantumDatatypeFactory.generateBitArray(sizeB);
            ConverterBinary conversionB = new ConverterBinary(dataB, sizeB);
            bool[] dataarrayB = conversionB.ToBoolArray();

            TesterLog("RANDOM QuantumBitArray Integrity Test");
            TesterLog("Store " + ArrayTools.BoolArrayToString(dataarrayB));
            TesterLog("Internal state", quantumbitarrayB.Debugger.ShortDebug);
            quantumbitarrayB.setBitArray(dataarrayB);
            TesterLog("Read Data");
            TesterLog(ArrayTools.BoolArrayToString(quantumbitarrayB.getBitArray()));
            TesterLog("Internal state", quantumbitarrayB.Debugger.ShortDebug);

            short sizeC = 8;
            short dataC = 42; //Numero mágico
            IQuantumArrayBit quantumbitarrayC;
            ConverterBinary conversionC = new ConverterBinary(dataC, sizeC);
            bool[] dataarrayC = conversionC.ToBoolArray();
            bool[] basisboolC = RandomnessFactory.GetManyBinary(sizeC);
            bool[] errorboolC = RandomnessFactory.GetManyBinary(sizeC);

            TesterLog("QuantumBitArray RANDOM CODING");
            TesterLog("Random basis" + ArrayTools.BoolArrayToString(basisboolC));
            TesterLog("Erroneus basis" + ArrayTools.BoolArrayToString(errorboolC));
            TesterLog("Store " + ArrayTools.BoolArrayToString(dataarrayC));
            quantumbitarrayC = QuantumDatatypeFactory.encodeArrayByBasis(dataarrayC, basisboolC);
            TesterLog("Internal state" + quantumbitarrayC.Debugger.ShortDebug);
            TesterLog("CORRECT Read Data");
              bool[] decodedokC = QuantumDatatypeFactory.decodeArrayByBasis(quantumbitarrayC, basisboolC);
              TesterLog(ArrayTools.BoolArrayToString(decodedokC));
              TesterLog("Internal state", quantumbitarrayC.Debugger.ShortDebug);
            TesterLog("ERRONEOUS Read Data");
              bool[] decodederroneusC = QuantumDatatypeFactory.decodeArrayByBasis(quantumbitarrayC, errorboolC);
              TesterLog(ArrayTools.BoolArrayToString(decodederroneusC));
              TesterLog("Internal state", quantumbitarrayC.Debugger.ShortDebug);
            TesterLog("AGAIN CORRECT Read Data");
              bool[] decodedagainC = QuantumDatatypeFactory.decodeArrayByBasis(quantumbitarrayC, basisboolC);
              TesterLog(ArrayTools.BoolArrayToString(decodedagainC));
              TesterLog("Internal state", quantumbitarrayC.Debugger.ShortDebug);
        }
Пример #3
0
 public static bool[] ByteArrayToBoolArray(byte[] data)
 {
     ConverterBinary conversions = new ConverterBinary(data);
     bool[] result = conversions.ToBoolArray();
     return result;
 }