コード例 #1
0
        public void Calculate_memory_cost_returns_0_for_0_length()
        {
            IEvmMemory memory = CreateEvmMemory();
            long       cost   = memory.CalculateMemoryCost(long.MaxValue, BigInteger.Zero);

            Assert.AreEqual(0L, cost);
        }
コード例 #2
0
        public void Save_empty_beyond_reasonable_size_does_not_throw()
        {
            IEvmMemory memory = CreateEvmMemory();
            UInt256    dest   = (UInt256)int.MaxValue + 1;

            memory.Save(ref dest, new byte[0]);
        }
コード例 #3
0
        public void Calculate_memory_cost_returns_0_for_0_length()
        {
            IEvmMemory memory = CreateEvmMemory();
            UInt256    dest   = long.MaxValue;
            long       cost   = memory.CalculateMemoryCost(ref dest, UInt256.Zero);

            Assert.AreEqual(0L, cost);
        }
コード例 #4
0
        public void Calculate_memory_cost_returns_0_for_subsequent_calls()
        {
            IEvmMemory memory = CreateEvmMemory();
            long       cost1  = memory.CalculateMemoryCost(BigInteger.One, BigInteger.One);
            long       cost2  = memory.CalculateMemoryCost(BigInteger.One, BigInteger.One);

            Assert.AreEqual(0L, cost2);
        }
コード例 #5
0
        public void Calculate_memory_cost_returns_0_for_subsequent_calls()
        {
            IEvmMemory memory = CreateEvmMemory();
            UInt256    dest   = UInt256.One;
            long       cost1  = memory.CalculateMemoryCost(ref dest, UInt256.One);
            long       cost2  = memory.CalculateMemoryCost(ref dest, UInt256.One);

            Assert.AreEqual(0L, cost2);
        }
コード例 #6
0
        public void Trace_when_position_not_on_word_border()
        {
            IEvmMemory memory = CreateEvmMemory();

            memory.SaveByte(EvmMemory.WordSize / 2, new byte[] { 1 });
            List <string> trace = memory.GetTrace();

            Assert.AreEqual(1, trace.Count);
        }
コード例 #7
0
        public void Trace_two_words()
        {
            IEvmMemory memory = CreateEvmMemory();

            memory.SaveWord(EvmMemory.WordSize, new byte[EvmMemory.WordSize]);
            List <string> trace = memory.GetTrace();

            Assert.AreEqual(2, trace.Count);
        }
コード例 #8
0
        public void Trace_one_word()
        {
            IEvmMemory memory = CreateEvmMemory();

            memory.SaveWord(0, new byte[EvmPooledMemory.WordSize]);
            List <string> trace = memory.GetTrace();

            Assert.AreEqual(1, trace.Count);
        }
コード例 #9
0
        public void Trace_when_position_not_on_word_border()
        {
            IEvmMemory memory = CreateEvmMemory();
            UInt256    dest   = EvmPooledMemory.WordSize / 2;

            memory.SaveByte(ref dest, 1);
            List <string> trace = memory.GetTrace();

            Assert.AreEqual(1, trace.Count);
        }
コード例 #10
0
        public void Trace_two_words()
        {
            IEvmMemory memory = CreateEvmMemory();
            UInt256    dest   = EvmPooledMemory.WordSize;

            memory.SaveWord(ref dest, new byte[EvmPooledMemory.WordSize]);
            List <string> trace = memory.GetTrace();

            Assert.AreEqual(2, trace.Count);
        }
コード例 #11
0
        public void Save_empty_beyond_reasonable_size_does_not_throw()
        {
            IEvmMemory memory = CreateEvmMemory();

            memory.Save((BigInteger)int.MaxValue + 1, new byte[0]);
        }