示例#1
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call ctor to construct a new instance");

        try
        {
            Encoder encoder = new TestEncoder();

            if (encoder == null)
            {
                TestLibrary.TestFramework.LogError("001.1", "Calling ctor to construct a new instance returns null reference");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
示例#2
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call ctor to construct a new instance");

        try
        {
            Encoder encoder = new TestEncoder();

            if (encoder == null)
            {
                TestLibrary.TestFramework.LogError("001.1", "Calling ctor to construct a new instance returns null reference");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
示例#3
0
        private void SetupAll(bool useLimboOutput = false)
        {
            var secrets = NetTestVectors.GetSecretsPair();

            FrameCipher       frameCipher       = new FrameCipher(secrets.A.AesSecret);
            FrameMacProcessor frameMacProcessor = new FrameMacProcessor(TestItem.IgnoredPublicKey, secrets.A);

            _encoder  = new TestEncoder(frameCipher, frameMacProcessor);
            _splitter = new TestSplitter();
            _splitter.DisableFraming();
            _zeroSplitter = new TestZeroSplitter();
            _zeroSplitter.DisableFraming();
            _zeroEncoder       = new TestZeroEncoder(frameCipher, frameMacProcessor);
            _snappyEncoder     = new TestSnappy();
            _zeroSnappyEncoder = new TestZeroSnappy();
            Transaction a = Build.A.Transaction.TestObject;
            Transaction b = Build.A.Transaction.TestObject;

            _block = Build.A.Block.WithTransactions(a, b).TestObject;
            _newBlockMessageSerializer = new NewBlockMessageSerializer();
            if (useLimboOutput)
            {
                _outputBuffer = new MockBuffer();
            }

            _newBlockMessage       = new NewBlockMessage();
            _newBlockMessage.Block = _block;
            _serializationService  = new MessageSerializationService();
            _serializationService.Register(_newBlockMessageSerializer);
            _packetSender = new PacketSender(_serializationService, LimboLogs.Instance);
            ResourceLeakDetector.Level = ResourceLeakDetector.DetectionLevel.Paranoid;
        }
        public void Encode_ABC_to_BCD_with_key_1()
        {
            const string str          = "ABC";
            const int    key          = 1;
            const string expected_str = "BCD";

            var actual_str = TestEncoder.Encode(str, key);

            Assert.AreEqual(expected_str, actual_str);
        }
示例#5
0
 public void AfterTest()
 {
     container.Dispose();
     container                = null;
     testFilePath             = null;
     config                   = null;
     encoder                  = null;
     decoder                  = null;
     moduleManagerMock        = null;
     configurationManagerMock = null;
     fileSystemMock           = null;
     bootstrapperMock         = null;
 }
示例#6
0
        public void BeforeTest()
        {
            container    = new CompositionContainer();
            testFilePath = new FilePath(@"C:\test", true);
            config       = new SessionConfiguration();
            encoder      = new TestEncoder();
            decoder      = new TestDecoder();

            moduleManagerMock        = new Mock <IModuleManager>();
            configurationManagerMock = new Mock <IConfigurationManager>();
            fileSystemMock           = new MockFileSystem();
            bootstrapperMock         = new Mock <IBootstrapper>();

            var hookMock = new HookNativeMethodsMock();

            hookMock.AllowLibraryLoad();
        }
示例#7
0
文件: Program.cs 项目: chargen/AGI-X0
    public static void testImageCompressor()
    {
        Vector2d <uint> imageSize = new Vector2d <uint>(5, 7);

        Map2d <float> stimulus = new Map2d <float>(imageSize);

        ImageDrawer <float> drawer = new ImageDrawer <float>();

        // draw candidate
        drawer.drawHorizontalLine(stimulus, new Vector2d <uint>(1, 1), 3, 1.0f);

        TestEncoder testEncoder = new TestEncoder();

        TestEncoder.Candidate bestCandidate = testEncoder.encode(stimulus);


        int debug = 1;
    }